相关疑难解决方法(0)

216
推荐指数
6
解决办法
9万
查看次数

如何使用jquery查找div中的所有数字并添加<span></span>标签?

我有一个DOM这样的

<div class="main_div">
    <p>A car averages 27 miles per gallon. If gas costs $4.04 per gallon, which of the following is closest to how much the gas would cost for this car to travel 2,727 typical miles?</p>    
</div>
Run Code Online (Sandbox Code Playgroud)

我只想为所有数字添加 span 标签,例如

<div class="main_div">
    <p>A car averages <span> 27 </span> miles per gallon. If gas costs $<span>4.04</span> per gallon, which of the following is closest to how much the gas would cost for this car to travel <span>2,727</span> typical …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

0
推荐指数
1
解决办法
1440
查看次数

标签 统计

javascript ×2

css ×1

html ×1

jquery ×1

string-conversion ×1