jQuery Hotkeys "Tab" on Chrome will still insert \t character, even after return false -
suppose have 2 code below, 1 uses alert()
1 doesn't. found in chrome, 1 using alert()
insert tab character \t
textarea.
$(function() { $("textarea").bind("keydown", "tab", function() { alert("something"); return false; }); $("textarea").bind("keydown", "shift+tab", function() { this.value = "don't alert()"; return false; }); });
why happening? , how can prevent behaviour (adding of tab character after return false)
you can try use code before "return false"
if(jquery.browser.msie) { event.cancelbubble = true; } else { event.stoppropagation(); }
you need add parameter event in each binding :
function(event) { ... }
Comments
Post a Comment