Javascript 如何清除数据占位符值?
我有一个输入字段Javascript 如何清除数据占位符值?,javascript,jquery,html,Javascript,Jquery,Html,我有一个输入字段 <span class="total_round_size inline-notoolbar-editable" data-placeholder="000,000">{{ deal.total_round_size|intcomma|safe }}</span> 最好不要改变跨度的结构(例如不要添加元素) 编辑: 更多细节 function parse(elem_name) { return parseInt($(elem_name).htm
<span class="total_round_size inline-notoolbar-editable" data-placeholder="000,000">{{ deal.total_round_size|intcomma|safe }}</span>
最好不要改变跨度的结构(例如不要添加元素)
编辑:
更多细节
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>
函数解析(元素名称){
返回parseInt($(elem\u name).html().replace(/[\,]/g,);
}
$('#target')。更改(函数(){
$('.total_round_size')。文本(解析('.target');
});
{%trans“总圆大小”%}:
欧元{{deal.total_round_size}intcomma | safe}{%if not deal.total_round_size%}
{%endif%}
目标基本相同。尝试将显示占位符的
更改为数据占位符
:
$('.total_round_size').attr('data-placeholder','');
由于您已将值分配给数据占位符
属性,而不是显示占位符
尝试此方法,效果良好:
$('.total_round_size').removeAttr('data-placeholder');
或
$('.total_round_size').attr('data-placeholder','');
试试这个
$('.total_round_size').attr('data-placeholder', '');
投票失败的原因是什么。
$('.total_round_size').attr('data-placeholder', '');