这段代码有一个小问题:
jQuery.fn.markCursor = function(e){
$(this).focus();
$(this).keyup(function(e) {
$cursorStart.enterText(e);
});
};
jQuery.fn.enterText = function(e){
if (e.keyCode == 9){
$cursor.val("");
alert("hello");
}
};
Run Code Online (Sandbox Code Playgroud)
Tab 键在浏览器中采用其默认行为,.preventdefault 在这里有帮助吗?我如何添加 12 个空格而不使代码占用 jquery 中的 12 行:p