如何用jQuery选择一个句子中的前两个单词,用span标签包装它们并在其后添加一个br标签?
像这样的东西:
<p><span>Lorem ipsum</span><br/> quosque tandem</p>
Run Code Online (Sandbox Code Playgroud)
但动态添加span和br标签.
我只能用这段代码为第一个单词做到这一点:
$('p').each(function(){
var featureTitle = $(this);
featureTitle.html( featureTitle.text().replace(/(^\w+)/,'<span>$1</span><br/>') );
});
Run Code Online (Sandbox Code Playgroud)
谢谢!!
我需要选择包含内容"tree"的列表元素,这个元素可以在任何位置,原始列表有很多结果.
<ul>
<li>House</li>
<li>Table</li>
<li>Tree</li>
<li>Boat</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
如何检查jquery
救命?!
我有一系列关键字......
(数组) - >(房子,桌子,马,树)
我需要创建一个这样的字符串:
房子+表+马+树
我怎么能用PHP做到这一点?
如何span
用表"数据"而不是$
字符包裹表格单元格中的数字(和仅数字)?
这是HTML标记:
<table>
<tr>
<th>Description</th>
<th>Weight</th>
<th>Views</th>
<th>Cost</th>
</tr>
<tr>
<td>Item description here</td>
<td class="data">37 pounds</td>
<td class="data">132 views</td>
<td class="data">$99.59</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)