tags:

views:

59

answers:

4

Hi,

if i have the following:

<input type="text" id="something_txtYear" />

How do select this in JQuery using just the "txtYear" part??

Malcolm

+1  A: 
$('[id$=txtYear]')
eyelidlessness
+1  A: 

$('input[id*=txtYear]')

meder
+1  A: 

You can use the attribute endsWith selector

$('input[id$=txtYear]')
CMS
+4  A: 

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.

A. Murka