Alex Rivera | Logout

prevent default action for tab key in chrome?

Asked 2011-05-11T08:27:04.337
30

i want to PREVENT the default action when the tab key is pressed and only wanna do it in chrome, i can't find a solution for that, can anyone please help ?

i am using jquery

Edit
Report

1 Answer

25

Here's an article on how to detect chrome: http://javascriptly.com/2008/09/javascript-to-detect-google-chrome/

And this question: Disable tab key on a specific div might help you on disabling the tab key. If you are able to combine both yourself, you've probably got it working.

The disable function would become something like:

$('.textarea').on('keyup mouseup', function(e) {
  if(e.which == 9) { e.preventDefault(); }
});

e.which = 9 is the tab key according to the last link given. If you are able to wrap the browser detection around it yourself, I guess you've got your working example.

answered 2011-05-11T08:32:58.287

Your Answer