开发者

JQUERY -- Finding text wrapped in a SPAN, and outputting that to a <UL> as <LI>s

I have a large body o开发者_如何学JAVAf text which has several sentences wrapped in yada

I'd like to find a way with JQUERY, to go through the entire body of text, and every time it find a span with class "findme", to take what ever copy is contianed between the tag and to append that to a UL as a LI

Ideas on how to do this efficiently?

THanks


Simplest way to do this is using each():

$("span.findme").each(function() {
  $("<li>").text($(this).text()).appendTo("ul");
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜