javascript - How to select all the Textareas which have their id in a particular pattern -


am new jquery , know class, id , name selectors in jquery.

in html have 6 textarea elements ids unique , there particular pattern id starts(ex: id= "ta1", id= "ta2".. , on.. ).

my question is, in jquery there way select these textarea elements id start particular pattern , end particular pattern ?

edit: want combination of both start , end patterns

you ca use selector like

$('textarea[id^="ta"]'); 

selects elements have specified attribute value beginning given string.

edit: combining can use this, let see ending patters *22,*32,**42 "2" ur ending pattern.

 $('textarea[id^="ta"]').filter('[id$="2"]'); 

Comments