我输入字段如何清除数据占位符值?
<span class="total_round_size inline-notoolbar-editable" data-placeholder="000,000">{{ deal.total_round_size|intcomma|safe }}</span>
当我改变另一个输入,数据被复制到这一点,但原文(“000000”)仍然存在,新的文字重叠。如何删除它?我尝试了几种方法,但没有任何效果:
$('.total_round_size').attr('showing-placeholder', '');
$('.total_round_size').innerHTML = "";
$('.total_round_size').text("");
$('.total_round_size').html() = "";
$('input[name=total_round_size]').val("");
不希望更改跨度的结构(例如不添加元素)。
编辑: 更多细节
function parse(elem_name) {
return parseInt($(elem_name).html().replace(/[\.,,]/g,''));
}
$('#target').change(function() {
$('.total_round_size').text(parse('.target'));
});
<div class="row">
<div class="col-md-12">
<div class="pull-left">{% trans "Total Round Size" %}:</div>
<div class="pull-left"> € <span class="total_round_size inline-notoolbar-editable" data-placeholder="000,000">{{ deal.total_round_size|intcomma|safe }}{% if not deal.total_round_size %}<br/>{% endif %}</span></div>
</div>
</div>
目标是基本相同的。
为什么downvote?这工作。 – DSblizzard