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
Post a Comment