Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    accessing form elements

    i have this form :
    Code:
    <form name="form1" >
    <input type="checkbox" name="usedata_193{1}1" id="usedata_193{1}1" value="1"/>
    <input type="button" onclick="sameDataSwitch('193{1}1');"/>
    </form>
    the id on the checkbox has curly braces on it..the problem is i dont know how to access the value of checkbox in javascript..i cant use :
    Code:
    document.form1.usedata_193{1}1
    because of the curly braces..are there any ways that i can grab data from elements in a form that has curly braces on their id?

    thanks so much

  • #2
    New Coder
    Join Date
    Apr 2007
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can use this, which I'm pretty sure is what one is supposed to use according to w3:
    Code:
    document.getElementById("usedata_193{1}1")


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •