I have three buttons, + value -. in this when i click + button value will increase and - value will be decrease .. i have wote the code in jSFIDLLE. it working.
And the value should not be minus. so i added one if condition. then my code is not working.
html-
<input type="Button" id='AddButton' value="+" />
<input type="Button" id='BoqTextBox' value="0" />
<input type="Button" id='MinusButton' value="-" />
javascript -
$('#AddButton').on('click', function () {
var input = $('#BoqTextBox');
input.val(parseFloat(input.val(), 10) + 1);
})
$('#MinusButton').on('click', function () {
var input = $('#BoqTextBox');
if(input>0)
{ input.val(parseFloat(input.val(), 10) - 1);}
})
inputis an object, a jQuery object. What makes you think it will be greater than 0?.val()property of input