I tried to search for this online but couldn't find anything that works
i want that after i press then class where id = 1 is changed to cls-checked
<a id='1' class='cls-up' onclick='vote("up",this);'></a>
<a id='1' class='cls-down' onclick='vote("up",this);'></a>
after pressing vote it goes to php and like is pressed i want to make users already see like without reloading
function vote(vote, val)
{
var params = {"vote": vote, "id": val.id};
$.ajax({
data: params,
url: 'vote.php',
type: 'post',
success: function (response) {
}
});
}
problem is i always have 2 elements with same id if each element had different id i could use this code
var x = document.getElementById("1");
x.className = "cls-2";