JQuery doesn't validate numbers larger than 9999 -
this weird.
the morgage calculator working on (i had question previous one) working way wanted except.... doesn't validate values greater 9999.
if go link below, you'll able see mean.
the code supposed make sure values entered in down payment , purchase price numbers. if they're not, message comes up, if are, code validates purchase price not greater down payment amount.
the code works... if values enter 9999 or lower. if do, example... 1350000 , 5000 down payment, code doesn't submit. if 9999 , 5000, no problem.
i'm confused. ideas?
here's html.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>assignment 8.1</title> <link rel="stylesheet" type="text/css" href="css/css.css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <script type="text/javascript" src="js/js.js" charset="utf-8"></script> </head> <body> <h1>mortgage calculator</h1> <form action="calc.php" method="post" id="mortgage-form"> <p class="errormessage" id="shouldbenumber">*this value can contain numbers</p> <p id="pprice"><span class="errormessage" id="ppmustbenumber">*</span>purchase price: <input type="text" name="purchase-price" id="purchase-price" value="0" /> <span class="errormessage" id="purchasepriceerror">please enter number value!</span> </p> <p id="dpayment"><span class="errormessage" id="dpmustbenumber">*</span>down payment: <input type="text" name="down-payment" id="down-payment" value="0" /> <span class="errormessage" id="downpaymenterror">down payment value must less purchase price!</span> </p> <p id="term">select term: <select name="loan-term" id="loan-term"> <option value="novalueselected">-- select term --</option> <option value="15yrs">15 years</option> <option value="20yrs">20 years</option> <option value="30yrs">30 years</option> </select><span class="errormessage" id="termrequired"> * term required.</span> </p> <div id="rate"></div> <p> <input type="submit" name="submit" id="submit" value="calculate!" /> </p> </form> <footer> <p>© copyright ricardo</p> </footer> </body> </html>
see jquery in jsfiddle please.
i changed 3 values integers - http://jsfiddle.net/flt8c/3/
var purchaseprice = parseint($('#purchase-price').val()); var downpayment = parseint($('#down-payment').val()); var loanterm = parseint($('#loan-term').val());
Comments
Post a Comment