I have the following loop which works fine however the problem is that the loop becomes stuck if $("voteid"+id[x]) element is not found on the page. Is there a way to check with an if statment that the element $("voteid"+id[x]) does exists, and if so proceed with the loop?
Thanks
for (var x = 0; x<voteids.length; x=x+1)
{
$("voteid"+id[x]).replace("","");
var total= parseInt($("total"+id[x]).innerHTML)+1;
$("total"+id[x]).innerHTML=total;
}