1
我有这样的代码:问题移动输入到右箭头键右侧用jQuery
jQuery.fn.enterText = function(e){
var $cursor = $("#cursor");
if (e.keyCode == 39){
e.preventDefault();
$cursor.val("");
var nextChar = $cursor.next();
$cursor.after(nextChar);
}
};
我试着给#cursor向右移动,但它似乎在浏览器不允许它....左箭头键的作用:
if (e.keyCode == 37){
$cursor.val("");
var previousChar = $cursor.prev();
$cursor.after(previousChar);
}
你可以在http://jsfiddle.net上做一个演示,这样我们就可以看到你看到了什么? – Neal
[jQuery caret定位](http://www.google.com/#q=jquery+caret+positioning) – Mottie