469,920 Members | 2,234 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,920 developers. It's quick & easy.

Cannot access checkbox element

I did a form, I created a checkbox under the same name 'lead_role' but I can't seem to access it in my javascript validation.

This is the code in my HTML page
<input name="lead_role" id="lead_role" type="checkbox" class="style30" value="1">

And this is the validation I am testing out

My browser returns me an 'undefined' alert message.

The only way I was successful in accessing the element is using the getElementById() method but that only gets the very first instance of the checkbox.

Can anyone help me out? Thanks :)
Feb 25 '07 #1
1 1140
16,027 Expert Mod 8TB
lead_role is an array of checkboxes, so loop through, e.g. the third checkbox checked value can be accessed by:
Expand|Select|Wrap|Line Numbers
  1. document.form1.lead_role[2].checked
Feb 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Mark Anderson | last post: by
2 posts views Thread by /.. | last post: by
reply views Thread by bill yeager | last post: by
4 posts views Thread by | last post: by
6 posts views Thread by Chuck Anderson | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.