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);
精彩评论