Dev.Opera - Follow the standards, break the rulesDev.Opera - Follow the standards, break the rules

Login

Lost password?

Forums » General Discussions

General DevOpera discussion group

Note: You need to login to post in the forums. if you don't have an account you first need to sign up.

By axel4891 anchor Wednesday, 6. February 2008, 22:51:09

avatar

how to prevent default keypress event

Hi

I've got a problem. For example I have 3 inputs on the page. How can I prevent (turn off) navigation by 'tab' key between these inputs? I've tried many things:
1. e.preventDefault();
2. e.stopPropagation();
3. return true;

and even such construction:

document.onkeypress = function(){
var e = window.event;
e.preventDefault();
e.stopPropagation();
}

but nothing of it turns off tab navigation. How can I solve it?
Thanks for advance.

By einzelgaenger83a anchor Friday, 4. April 2008, 15:36:52

avatarNo Solutions? I have the same problem and I'm very interested to know how to solve it

By moginspace anchor Wednesday, 9. April 2008, 15:09:22

avatarWell not sure why you'd want to take away the browser's basic functionality? Don't you want users to be able to jump into an input field?

Anyway... the only way I know to get an input out of the tab cycle is to change the <input> tag to disabled like this:
<input type="text" disabled>

If your inputs are styled with css then they will look the same even though one is disabled.
Like this:
<input tabindex="1" type="text" style="background-color:#fff;">
<input tabindex="2" type="text" style="background-color:#fff;">
<input tabindex="3" type="text" disabled style="background-color:#fff;">


Moderators: jax | malware | mcx | operadev