我正在使用 jQuery 循环页面上的引号,并且我想在每个 block 引用中找到引用文本,我该如何做呢?
我像这样循环它们:
$('.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);
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<blockquote class="comment_quote"><cite>name</cite>the quoted test</blockquote>
最佳答案
$(this).find('cite').text()
应该这样做,如果我理解正确的话。
关于javascript - 如何获取引用中的引用文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46507615/