javascript - Increase textbox value by .25 -


i have form has service time field want incremented .25 upon each click of + button.

i have following code:

<script language=javascript>     $(document).ready(function(){     $("#up").on('click',function(){         $("#incdec input").val(parsefloat($("#incdec input").val())+0.25);     });      $("#down").on('click',function(){         $("#incdec input").val(parsefloat($("#incdec input").val())-0.25);     }); }); </script> 

and html part:

<div class="form-group" id="incdec">     <label for="time" class="col-sm-2 control-label">time:</label>     <div class="col-sm-10"><input name="time" value="<%=rs.fields.item("time")%>"></div>     <button id="up">+</button>     <button id="down">-</button> </div> 

this works fine upon clicking + or - increases/decreases submits form it's in. want able increase/decrease in text field submit form button.

i know missing stupid here!

the type attribute of button defaults "submit". you'll want add type="button" prevent submission occurring.

see https://www.w3.org/tr/html5/forms.html#attr-button-type