jquery - Circumvent random number in ID -


i got line in script, check items class:

$('#post').attr('class'); 

is there chance, read like:

$('#post*').attr('class'); 

so if id fe. post405 still read this? i've checked , won't work * , so there other way read items way?

$('[id^=post]').attr('class'); 

you're looking [attribute^=*] selector.


Comments