I’m trying to get text inside .fromTo but the script doesn’t work.
Do I think correctly if the first part goes to the <a> element. And then it will search for the child and then get the text?
jQuery
to_user = $("a#"+msg_id).find("div.fromTo").text()
html
<a href="" id="27" class="msgLink">
<div style="background:url(/media/user_avatar/comment_thumbnails/8.png);" class="msgImg"></div>
<div class="fromTo">spelia</div>
<div class="messageBody">wdwdwdw</div>
<div class="message_date">8 hours ago</div>
<div class="clearIt"></div>
</a>
The
#idsyntax works if you access directly through id. If you want to access tag name first then give id (or any other attribute) then following way will workSimilarly you can access an element with any attribute
$("a[attribute_name='"+desired_value+"']")You can details here http://api.jquery.com/category/selectors/attribute-selectors/