I'm developing budget diary web app and have problems with frontend, I have problems with updating budget . Here is my code for Income:
script.js
var sum =0;
$('#li-income-val').each(function() {
sum += Number($(this).text());
});
$("#budget-income").text(sum)
html code
<li id="li-icnome">
<p class="dashboard__income__text">
{{incom.title}}
</p>
<p id="li-income-val">{{incom.value}}</p>
</p>
</li>
Is there any solutions ?
idon all theliandpelements which is invalid; they have to be unique in the DOM. Change it to a class.