开发者

Unobstrusive javascript for Forgot Password Link

开发者 https://www.devze.com 2023-04-10 02:19 出处:网络
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 t

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号