asp.net - how to select first list Item in <asp:dropdownlist > using javaScript -
this code
<asp:dropdownlist id="lue1" runat="server"> <asp:listitem selected="true" value=" - select 1 - "> - select 1 - </asp:listitem> <asp:listitem value="silver"> silver </asp:listitem> <asp:listitem value="darkgray"> dark gray</asp:listitem> <asp:listitem value="khaki"> khaki </asp:listitem> <asp:listitem value="darkkhaki"> dark khaki </asp:listitem> </asp:dropdownlist> <br /> <a class="bullet blt-add" id="lnkaddanother1" href="javascript:" onclick="shownextcountrol(this,2)">add another</a>
function shownextcountrol
show dropdownlist
, selected listitem
first 1
function setselectedindex(s, i) { s.options[i-1].selected = true; return; } setselectedindex(document.getelementbyid("lue1"),2);
// @ position of 2 give position u need
Comments
Post a Comment