Aug 4, 2005 #1 Mayoor Programmer Jan 16, 2004 198 GB I would like to loop through the form elements and test to see where the 3rd character of the ID name is a "3". if TheElem.id.CharAt(2) == 3 Can I simply just do this?
I would like to loop through the form elements and test to see where the 3rd character of the ID name is a "3". if TheElem.id.CharAt(2) == 3 Can I simply just do this?
Aug 4, 2005 #2 BillyRayPreachersSon Programmer Dec 8, 2003 17,047 GB Not quite... although you're almost there. charAt has a lowercase "C" at the beginning... remember that JS is case-sensitive. Also, you're missing brackets around your "if" test. Try this: Code: if (TheElem[i].id.charAt(2) == '3') { // do something here } This, of course, assumes that "TheElem" is a valid form element. Hope this helps, Dan [tt]Dan's Page [blue]@[/blue] Code Couch http://www.codecouch.com/dan/[/tt] Upvote 0 Downvote
Not quite... although you're almost there. charAt has a lowercase "C" at the beginning... remember that JS is case-sensitive. Also, you're missing brackets around your "if" test. Try this: Code: if (TheElem[i].id.charAt(2) == '3') { // do something here } This, of course, assumes that "TheElem" is a valid form element. Hope this helps, Dan [tt]Dan's Page [blue]@[/blue] Code Couch http://www.codecouch.com/dan/[/tt]
Aug 4, 2005 #3 tsdragon Programmer Dec 18, 2000 5,133 US Don't see why that wouldn't work. Tracy Dryden Meddle not in the affairs of dragons, For you are crunchy, and good with mustard. Upvote 0 Downvote
Don't see why that wouldn't work. Tracy Dryden Meddle not in the affairs of dragons, For you are crunchy, and good with mustard.