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

Hassan Schroeder hassan.schroeder at gmail.com
Fri Jun 29 16:13:39 CDT 2007

On 6/29/07, Jon Hughes <hughesj at firemtn.com> wrote:

> 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...

? It would be a pretty sparse language that didn't have basic string
comparison functions but maybe I'm not on the same page here re'
"elegant" :-)

  if ( title.indexOf("Required") > -1 ) { /* something */ }

..is what I'd probably do...

Hassan Schroeder ------------------------ hassan.schroeder at gmail.com

More information about the thelist mailing list