jquery - Javascript multiply on click -


i want have default value (10 example) , button increase same value on every click.. can't script work

<div id="output">10</div> <div id="increase">increase</div>  <script> $('#increase').click(function() { var 1 = $('#output').val(); var increase = 10; var output = +one + increase;  $('#output').val(output.tofixed(2)); document.getelementbyid('output').innerhtml = value; }); </script> 

https://jsfiddle.net/t5ud192g/3/

include jquery , set try code:

    $('#increase').click(function() {       var 1 = $('#output').text();       var increase = 10;       var output = number(one) + increase;        $('#output').text(output.tofixed(2));      }); 

take @ number(one), convert string number.

edit use .text() function get/set value div.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -