admin管理员组文章数量:1389779
Hello I have the folowing HTML element :
<li class="total_payment" data-basetotal="0.00">
<span>
<h5>Total</h5>
</span>
</li>
I want to change the data-basetotal value from 0.00 to 50.00 with jQuery jQuery v1.7.2 using :
$(document).ready(function(){
$('.total_payment').attr('data-basetotal', '50.00');
});
but it is not working , how can I change the value please?
Thanks
Hello I have the folowing HTML element :
<li class="total_payment" data-basetotal="0.00">
<span>
<h5>Total</h5>
</span>
</li>
I want to change the data-basetotal value from 0.00 to 50.00 with jQuery jQuery v1.7.2 using :
$(document).ready(function(){
$('.total_payment').attr('data-basetotal', '50.00');
});
but it is not working , how can I change the value please?
Thanks
Share Improve this question asked Sep 23, 2015 at 14:47 oussama kamaloussama kamal 1,0373 gold badges23 silver badges46 bronze badges 3- Looks like that class should be an id if its unique which appears to be. – Andy Commented Sep 23, 2015 at 14:47
- That should work as written, can you reproduce the failure? And define what "not working" means in the context of your question. – David Thomas Commented Sep 23, 2015 at 14:49
- 4 It works for me – Stryner Commented Sep 23, 2015 at 14:52
1 Answer
Reset to default 5Try to use
$('.total_payment').data('basetotal', '50.00');
本文标签: javascriptjQuery change data attribute valueStack Overflow
版权声明:本文标题:javascript - jQuery change data attribute value - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744634521a2616743.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论