如何在包含類「data」的表格單元格中的數字(而不是數字)周圍包含span
而不是$
字符?只用jQuery包圍數字
這裏的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>
你能提供你已經嘗試實現你找什麼碼? –
您可以逐個查看字符串中的字符,當您達到第一個數字時,可以在前面放置'',類似於第一個非數字字符和'',或者您可以使用「regular表達式和'.replace()' – david
對不起,我是一個jQuery初學者,我完全不知道如何做到這一點......我一直在研究在stackoverflow的答案,但沒有發現任何東西。 – amp511