[thelist] finding a string in a string with javascript?

Jon Hughes hughesj at firemtn.com
Fri Jun 29 15:45:52 CDT 2007


I have the following:

JavaScript:

var inputs = form.getElementsByTagName("input");
for ( var i=0; i < inputs.length; i++) {
var title = inputs[i].title
if ...
}

HTML:

<label for="fname" id="lfname">First Name:</label>
<input type="text" name="fname" id="fname" title="Please input your
First Name (Required)" />

I basically want this script to read the title of the input, and if it
has "required" in it, to perform an action, and if it doesn't to ignore
it and move on to the next in the array.

I googled a bit, but couldn't find any elegant solutions...

Anyone know a good way to do this?

Thank You,
- Jon Hughes 



More information about the thelist mailing list