任何人都可以幫我這個嗎?當我嘗試替換此貨幣符號時,它會移動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