jQuery: Adding One to Number Inside Element

Posted by Chicken Soup on Stack Overflow See other posts from Stack Overflow or by Chicken Soup
Published on 2010-03-26T01:20:58Z Indexed on 2010/03/26 1:23 UTC
Read the original article Hit count: 419

Filed under:
|

I'm trying to add one to a number inside a p element with jQuery, but it doesn't work.

$(document).ready(function() {
            function addOne() {
                var number  =   $('p').html();
                return number++;
            }

            $('p').text(addOne());
        });

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript