Hi everyone, I've been banging my head against a wall trying make this work for a while now. I'm trying to shorten the comment body to one line for compact comment preview. I'm using jquery .each function to go through each .cbody (comment body) in my threaded comment system and place it in the cshort div inside chead. It should work but i cant select the cshort class in the top line. Any help is very appreciated. As far as i can see my jquery should be this:
$('.cbody').each(function(Ind1){
var str = $(this).text();
$(this).parent().siblings('.chead').next('.cshort').html(str);
});
});
This is the html for the comment:
<ul>
<li>
<div id="23">
<a name="23">
</a>
<div class="chead">
<a href="#" class="unord">
<img src="images/plus.gif" border="0">
</a>
<a href="userinfo.php?user=muuuuuuuu">
<img src="include/avatar/n.jpg" border="0">
</a>
<span style="display: none;" class="uname">
usersname
</span>
,
<span class="cshort">
</span>
<span class="votes_up" id="votes_up23">
2
</span>
-
<span class="votes_down" id="votes_down23">
0
</span>
<span class="vote_buttons" id="vote_buttons23">
<a href="javascript:;" class="vote_up" id="23">
</a>
<a href="javascript:;" class="vote_down" id="23">
</a>
</span>
</div>
<div class="cbody">
<br>
The comment text funny lol
</div>
<a style="display: none;" href="#" class="reply" id="23">
Reply
</a>
<a style="display: none;" href="#21" class="cparent">
Parent
</a>
</div>
</li>
</ul>