正确我不知道从哪里开始,当涉及到正则表达式,但我认为这是正确的方式去与此... 我想与javascript分离html我正在回想一下html元素所以:正则表达式在JavaScript中分割一个html字符串?
$('.HomeFeaturedPrice').each(function(index, el) {
var grabPrice = $(this).html();
var convertPrice = Number(grabPrice);
console.log(convertPrice);
});
convertPrice可以输出到现在不同的选择:
选项之一是:$50.00
方案(2):<span id="salesprice">$50.90</span>
我怎样写一个正则表达式拿起只有价格。 ... 剥离出所有的html和美元符号... Chris
[RegEx match open tags not except XHTML self-contained tags]可能重复(http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags) – bmargulies
好吧,如果不是正则表达式,那么如何呢? – vimes1984