我已经生成了带有价格值的输入。
示例:
<input type="text" value="59,00"/>
现在我应该使用jQuery用,
(点)替换.
(逗号)。
我尝试了这个,但它不起作用:
$('#inputid[value~=,]').each(function(i){
$(this).text($(this).text().replace(',','.'))
});
你能帮助我吗
答案 0 :(得分:4)
$('input:text').each(function() {
var value = $(this).val();
$(this).val(value.replace(/\,/i, '.'));
});