Is it possible to use jquery to add numbers taken from mysql?

Posted by Scarface on Stack Overflow See other posts from Stack Overflow or by Scarface
Published on 2010-04-19T03:10:09Z Indexed on 2010/04/19 3:13 UTC
Read the original article Hit count: 231

Filed under:
|
|

Hey guys quick question. I have a div that gets assigned a number to its id that is taken from the database on page load. I am trying to use jquery to add 1 to that number but for example if the number was 70 to begin with it just becomes 701. Anyone know what I am doing wrong?

echo "<div class=\"total\" id=\"$total\">$total</div>";

var total=$(".total").attr("id");

var newtotal=total+1;
$('.total').html(newtotal);

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about php