javascript - How to use part of the Id or Class of DOM element with jQuery selector? -


how use part of id or class of dom element jquery selector?

i.e. have

id="some_extra_name" 

can use "extra" elements jquery?

yes, can do

$elements = $('[id*=extra]'); 

if wanted elements id starts "extra", you'd

$elements = $('[id^=extra]'); 

and elements id ends "extra" :

$elements = $('[id$=extra]'); 

relevant documentation


Comments

Popular posts from this blog

python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -

node.js - Nodejs javascript implementation of PBEWithMD5AndTripleDES/CBC/PKCS5Padding -