I'm trying to make a simple rating system using php and javascript . the idea is to change the value of HTML div (number of rate) using javascript without refreshing the page , the problem is that i can't get the value of the HTML div . this is the div :
<div id="rating" >5565</div>
and i try to get this value using javascript
function give_id_like() {
var a = document.getElementById("rating").value;
var c = a + 1;
document.getElementById("rating").innerHTML = c;
}
but i get this result, for example if i have in the div 88 when i run the function i get this 881 if i run it again i get 8811 . what i want is when i run the function i want to get 89 and when i run it again 90 and so on .