javascript - Disable/remove a value in dropdown list -


in below code have dropdown list values want remove/disable product, doesn't work:

<editable:editabledropdownlist id="dpval"  runat="server" style="width: 70%; height:29px"  enableviewstate="true" onfocus="javascript: if(this.value=='--select--'){this.value='';}" onblur="javascript: if(this.value==''){this.value='--select--';}">     <asp:listitem text="---select---" value="0"></asp:listitem>                                                      <asp:listitem text="salt" value="1"></asp:listitem>     <asp:listitem text="book" value="2"></asp:listitem>     <asp:listitem text="product" value="3"></asp:listitem> </editable:editabledropdownlist>  <script>      var mycombo = $('#<%=dpval.clientid %>');                     mycombo.append($('< option > </option>').val(1).html(option1text));                     $("#<%=dpval.clientid %> option[value='3']").remove(); </script> 

your code not waiting until jquery gets loaded.

under script, write code in following function.

$(function(){    //your code goes here. }); 

this gets called after jquery gets loaded.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -