NaughtySquid NaughtySquid - 3 years ago 165
HTML Question

how to get the cite text inside a quote?

I've tried googling and searching for this and even though it seems so basic I'm at a loss.

I'm looping over quotes on a page with jquery and I want to find the cite text within each blockquote, how would I go about doing it?

I'm looping over them like this:

$('.comment_quote').each(function()
{
var actual_text = $(this).text();
var content = $(this).outerHTML();

if(actual_text.length > showChar)
{
var html = '<span class="morecontent">' + content + '</span><a href="" class="morelink">' + moretext + '</a><br />';

$(this).replaceWith(html);
}
});


This is the html it would be looping over as an example:

<blockquote class="comment_quote"><cite>name</cite>the quoted test</blockquote>

Answer Source

$(this).find('cite').text() should do it, if I understand you correctly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download