File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Handling dot in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Handling dot in javascript" Watch "Handling dot in javascript" New topic

Handling dot in javascript

Sahil Sharma
Ranch Hand

Joined: Aug 27, 2003
Posts: 152

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!

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
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";

Don't get me started about those stupid light bulbs.
subject: Handling dot in javascript
jQuery in Action, 3rd edition