[Javascript] Dollar function for name=

Peter Brunone peter at brunone.com
Tue Jun 1 10:16:21 CDT 2010


You mean document.getElementsByName?

----------------------------------------
 From: "Terry Riegel" <riegel at clearimageonline.com>
Sent: Tuesday, June 01, 2010 10:07 AM
To: "JavaScript List" <javascript at lists.evolt.org>
Subject: [Javascript] Dollar function for name=

Hello All,

Is there a method for finding a name="whatever" on a page similar to 
document.getElementById('whatever')?

For example suppose I have this form...

<form action="go.html" method="post">
<input type="text" name="myname">
<input type="text" name="mypass">
<input type="submit" name="mysubmit" value="Login">
</form>

I would like to target name="myname" in a similar way that I can with 
getElementById()

Even if it takes a fair bit of code to do it it would be nice to have a 
'dollar' type function for this.

When I use the term dollar function I am referring to the fairly ubiquitous 
convenience function for getElementById() found in the popular javascript 
library prototype.

Thanks,

Terry Riegel


More information about the Javascript mailing list