jquery - Get child of element by attribute value -


i have jquery object representing div:

$rel = $('#rel_'+rel.id); 

in div, there button custom attribute "rid" set rel.id

i need select button, works this:

$("[rid='"+rel.id+"']").html(); 

but think that's not fastest possible solution needs parse whole dom , because know button inside div, avoid that.

i tried following code:

$rel.children("[rid='"+rel.id+"']").html(); 

but didn't work.

thanks help.

if may not immediate child, you'll want find rather children (which looks @ immediate children):

$rel.find("[rid='"+rel.id+"']").html(); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -