Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling dot in javascript

 
Sahil Sharma
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

in my html the names of my textboxes are like this "attributes(first_name).value"

Now i need to peform a validation on this textbox, let's say mandatory check.

But i don't know how to escape the dot "." that is present in the name of the textbox "attributes(first_name).value"

when i write this in my javascript

document.forms[0].attributes(first_name).value.value then i doesn't work.

Please help!

thnx
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will not ask why in the world they are named like this

You need to use the element array

document.forms[0].elements["elementName"].value = "asdf";

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic