Select an element by name with jQuery

You can use the attribute selector for selecting an element with its name.
For example if you have to select input with its name.




$('input[name=tcol1]') // matches exactly 'tcol1'

$('input[name^=tcol]') // matches those that begin with 'tcol'

$('input[name$=tcol]') // matches those that end with 'tcol'

$('input[name*=tcol]') // matches those that contain 'tcol'

No comments:

Post a Comment