順序付けられていないリスト内のテキストをラップする必要があります<span>
これを試してみましたが、うまくいかないようです...
$('li').each(function(){
var text = $(this).text();
text = text.replace(/^(\w){1}/, "<span>$1</span>");
$(this).html(text);
});
順序付けられていないリスト内のテキストをラップする必要があります<span>
これを試してみましたが、うまくいかないようです...
$('li').each(function(){
var text = $(this).text();
text = text.replace(/^(\w){1}/, "<span>$1</span>");
$(this).html(text);
});
jQueryの.wrap()メソッドを使用するだけです
$('li').each(function(){
$(this).contents().wrap('<span></span>');
});
$('li').each(function(){
var text = $(this).text();
text = "<span>" + text + "</span>";
$(this).html(text);
});