任何人都可以帮我这个吗?当我尝试替换此货币符号时,它会移动span标记内的符号,这会导致我的其他代码出现问题。jQuery替换文字问题
我已经添加了我的代码在这里jsbin:http://jsbin.com/usuraw/2
感谢
<select id="inv_currency">
<option value="£">£</option>
<option value="€">€</option>
</select>
<span class="invE_balance currency">
£
<span>0.00</span>
</span>
JS:
$('#inv_currency').on('change', function() {
var currency = $('.currency');
if ($(this).val() == 'pound') {
currency.each(function(index) {
var text = '';
text = $(this).text();
text = text.replace("€", "£");
$(this).text(text);
});
}
else {
currency.each(function(index) {
var text = '';
text = $(this).text();
text = text.replace("£", "€");
$(this).text(text);
});
}
});
是有史以来值 “咚咚” ??? – adeneo 2013-02-18 15:54:45
尝试将“磅”更改为实际值。 – 2013-02-18 15:55:43