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:

http://jsbin.com/sidakata/2/

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

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -