jquery - javascript function doesn't execute -
hi,i have simple login form, fields validated javascript. don't why below code not working.
my html , js code:
<head> <script type="text/javascript"> function handlelogin() { var u = $("#username").val(); var p = $("#password").val(); if(u=="a" && p=="a") { window.location="/site/site.html"; } else { alert("fail"); } } </script> </head> <li dojotype="dojox.mobile.listitem"> <input dojotype="dojox.mobile.app.textbox" placeholder="username" type="text" id="username" name="username" /> </li> <li dojotype="dojox.mobile.listitem"> <input dojotype="dojox.mobile.app.textbox" placeholder="password" type="password" id="password" name="password" /> </li> <li dojotype="dojox.mobile.listitem"> <input dojotype="dojox.mobile.button" onclick="handlelogin()" type="button" id="submit" name="submit" value="login"/> </li>
when click on submit button nothings happening.
thanks
you didn't load jquery library. can without it:
var u = document.getelementbyid('username').value, p = document.getelementbyid('password').value;
changing page done location.href
instead of window.location
:
location.href = '/site/site.html';
Comments
Post a Comment