开发者

how to find check box id in javascript

how to find check box id and use the :checked selector to determine if it is checked in javascript.i am not getting checkbox id in javascr开发者_StackOverflowipt


My favorite method is to create a javascript variable and put the checkbox's ClientID into it:

<script language="javascript">

    var myCheckBox = '<%= myCheckBox.ClientID %>';

</script>

Then somewhere else you can just use that variable to find the control you want. This way even if you end up changing the actual ID of the object in question, the ClientID will automatically update and you won't have to update your javascript that matches it:

document.getElementById(myCheckBox);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜