jquery - Parent() isn't Working... Don't Know How to Select That Element! -
there lot of div.post. need select 1 of them... 1 have $(.comment_this').attr('rel'). , add new tag in <!-- here! --> place. idea?
firebug says parent() isn't function... jquery 1.6.1.
<div class="post"> <div class="post_head"><div> </div></div> <div class="post_body"> <!-- ... --> <div class="options"> <a class="gray_button comment_this" href="#" rel="123">comments</a> <span class="gray_txt">0 comments</span> </div> <!-- here! --> </div> <div class="post_bottom"><div> </div></div> </div> this have...
$('.post .comment_this').attr('rel').parent().html('foo');
to select element has attribute, use has-attribute selector [name]. attr returns value of attribute, rather filtering it. strings (such "123") don't have parent method!
you need after, rather html, don't overwrite wanted content.
$('.comment_this[rel]').parent().after('your html');
Comments
Post a Comment