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");
});
精彩评论