jquery - javascript drop-down filling -
i populating dropdown through javascript using asp.net, , have taken help of 1 of answers on site. used next code:
<script type="text/javascript"> $(document).ready(function () { alert("hi"); var select = document.getelementbyid('<%=ddlitems%>'); var alternative = document.createelement("option"); option.value = "1"; option.innerhtml = "option1"; select.appendchild(option); }); </script> it's not working. checking whether programme flow entering function, have set alert box. it's showing me proper alert, means entering function below code not working. may problem?
use ddlitems.clientid
<script type="text/javascript"> $(document).ready(function () { alert("hi"); var select = document.getelementbyid('<%=ddlitems.clientid%>'); var alternative = document.createelement("option"); option.value = "1"; option.innerhtml = "option1"; select.appendchild(option); }); </script> javascript jquery asp.net
No comments:
Post a Comment