问题
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
回答1:
Try to use
$('.total_payment').data('basetotal', '50.00');
来源:https://stackoverflow.com/questions/32742738/jquery-change-data-attribute-value