开发者

How to disable an accesskey in an <input>

开发者 https://www.devze.com 2023-03-13 06:53 出处:网络
I\'m using a predefined PHP framework, which I am to extend. jQuery/jQueryUI are included. The site has some links with an accesskey element defined. For example, pressing L logs you out immediately.

I'm using a predefined PHP framework, which I am to extend. jQuery/jQueryUI are included.

The site has some links with an accesskey element defined. For example, pressing L logs you out immediately. And there is the trouble.

Sometimes, pressing l in an <input type="text"/> logs me out. Sometimes not. Needless to say, it should not do so. I can't always reproduce that error, but I have not yet found out when it triggers and when not.

So, without being able to remove that accesskey element开发者_高级运维 in the framework, how can I prevent that behaviour?


First, you should probably have a confirmation dialog for logging out, especially with such an easy way to do so accidentally. Second, I'm not sure exactly how this accesskey code works without you showing more information about it, but it would be something like this:

$(':input').focus(function(e) { 
    // disable accesskey functionality 
});
$(':input').blur(function(e) { 
    // reenable accesskey functionality 
});


Disable the JavaScript on the Browser. Simple.

0

精彩评论

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

关注公众号