js:
$(".test").focusout(function(){
var qtdCont = parseInt($(this).val());
if(qtdCont > 0)
{
var qtdProd = $(".value").val();
var qtdProdInt = parseInt(qtdProd);
var qtdProdTot = qtdProd-qtdCont;
$(".value").val(qtdProdTot);
}
});
Demo: Jsfiddle
i need the subtract only the fist time when he lose the focus.
because if u go’s back and focusout again, the subtraction (obviously) will happen again.
how can i control that ?
thank you.
Use the
datain the dom element:Fiddle: http://jsfiddle.net/dNEmD/19/
UPDATE
Fiddle: http://jsfiddle.net/dNEmD/27/