Reputation: 12512
I need to wrap the text within unordered list with <span>
Trying this, but it does not seem to work...
$('li').each(function(){
var text = $(this).text();
text = text.replace(/^(\w){1}/, "<span>$1</span>");
$(this).html(text);
});
Upvotes: 1
Views: 1611
Reputation: 103368
$('li').each(function(){
var text = $(this).text();
text = "<span>" + text + "</span>";
$(this).html(text);
});
Upvotes: 1