How To Clear An Asp.net Listbox With Javascript?
I'm trying to clear all of the items in an ASP.NET listbox via javascript, but sadly document.getElementById('<%= lstNames.clientID %>').items.clear; does not work. Any idea
Solution 1:
Use jquery document.getElementById("<%= lstNames.clientID %>").empty()
or
document.getElementById("<%= lstNames.clientID %>").options.length = 0;
Post a Comment for "How To Clear An Asp.net Listbox With Javascript?"