if i have the following:
<input type="text" id="something_txtYear" />
How do select this in JQuery using just the "txtYear" part??
Malcolm
Either $('[id$=txtYear]') to match only at the end of the id or $('[id*=txtYear]') to match anywhere in the id.
You'll want to look at: http://docs.jquery.com/Selectors , scroll down to the section on Attribute Filters.
Very important. You must have quotes around the value for jQuery 1.4.4 and above. This is how the selector should look now:
This does NOT work in jQuery 1.4.4
$('[id=txtYear]')
This does work for jQuery 1.4.4 and above:
$('[id="txtYear"]')
We had to update all of our code when we upgraded. This link gives a find and replace regular expression on how to fix this. http://nickjohnson.com/b/jquery-upgrade-how-to-fix-attribute-value-selector-errors