I'm currently working on something which may be called reply to someone post under some kind of article.
Basically, what I want to achieve is when you click 'reply to post' (.comment-reply class) which is under the post - you grab it's author name from .comment-username div and you put it to the textarea. The problem is to target this div and grab its content which I want to put in variable and put later to the textarea. Cannot figure this targeting and grabbing. The basic structure of entry is like this:
<div class="comment-block comment-child">
<div class="comment-info title-small text-bold">
<div class="push-left">
<span class="comment-username sm-fc">AUTHOR NAME is here</span>
<span class="comment-time">some date</span>
</div>
<div class="push-right">
<span class="comment-rating">some int value</span>
</div>
<div class="clear"></div>
</div>
<div class="comment-text">
Sample text => Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</div>
<div class="comment-functions">
<span class="comment-reply title-small text-bold">reply to post</span>
<span class="comment-rate comment-plus"> + </span>
<span class="comment-rate comment-minus"> - </span>
</div>
</div>
Furthermore, on the same page will be displayed a lot of posts so I dont want to use IDs for every single post, instead of that I'm using classes which is more clear to me in that case.
I've been trying with $.prev()
, $.closest()
but no results.
Any suggestions?