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');