Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何清除数据占位符值?_Javascript_Jquery_Html - Fatal编程技术网

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">&nbsp;€&nbsp;<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', '');