Javascript alert when customer fill in the wrong price -
i have form (input type="text" name="amount") customer need fill in total price. because price 1 19,95 dollar. when need 2 39,90 dollar etc.
so: 1= 19,95, 2= 39,90, 3= 59,85
is possible when customer fill in wrong price (for example 20,00 instead of 19,95) there javascript alert. if can me code.
thanks
created js bin you:
just sample, have add complete logic yourself!
html:
<input id="total" type="text" onkeyup="validateinput();" /> javascript:
function validateinput() {     var total = parsefloat($('#total').val());     if(!isnan(total))       {         // add logic here         // sample:         if(total > 19.95)           {             alert('wrong price dude!');           }       } } 
Comments
Post a Comment