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 2.7 - Chat Solution for Mobile App -

jquery - Detect current Section with javascript -