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

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -