Unobstrusive javascript for Forgot Password Link
I have a spring form t开发者_如何转开发hat is used to log in to the website. Its a simple spring form with a username and password fields and a submit button. There is a forgot password link next to the submit button, which uses href="javascript:jump();" function as below:
function jump() {
document.forms[0].action='pwdSelfResetStep1.mobi';
document.forms[0].submit();
}
this works perfectly when the browser has javascript enabled. However, i want to use it on the browsers where javascript is disabled as well. (unobstrusive JS). Any help is really appreciated.
I assume that the reason you submit the form is to get the user's email address, so you won't be able to do that (dynamically) without javascript, but you can simply change the href on the link to "pwdSelfResetStep1.mobi" instead, and attach jump() to the onclick
event of the link.
精彩评论