I want to insert some text after the text in the span as follows. I want add the × after Tag1 like "Tag 1 ×". But it the × is after the </span>
, which means outside the span. Thanks.
我想在span中的文本后插入一些文本,如下所示。我想在Tag1之后添加×,如“Tag 1×”。但它的时间是在 之后,这意味着在跨度之外。谢谢。
BTY, is there any good suggestion for the delete button for the tags?
BTY,对于标签的删除按钮有什么好的建议吗?
html:
<li><span>Tag 1</span></li>
jquery:
$('li span').append('<p>×</p>');
2 个解决方案
#1
5
var span = $('li span');
span.html(span.html() + '×');
Is this what you're looking for?
这是你在找什么?
If you want to do it in one line:
如果你想在一行中做到这一点:
$(that).find('span')[0].innerHTML += '×';
#2
0
$('li span').after('×');
#1
5
var span = $('li span');
span.html(span.html() + '×');
Is this what you're looking for?
这是你在找什么?
If you want to do it in one line:
如果你想在一行中做到这一点:
$(that).find('span')[0].innerHTML += '×';
#2
0
$('li span').after('×');