然后用户使用TAB或SHIFT-TAB“跳转”到某个文本框,并且该文本框中恰好有一个值,然后该值将被自动选中。我想禁用此行为。
我认为可以在focusin事件处理程序中完成:
$("input:text").focusin(function() {
// "un-select" the value and place the text-cursor
// at the beginning or end of the value
});
答案 0 :(得分:3)
$(function() {
$('input').bind('focus', function(e) {
return false;
});
});
使用jQuery 1.4.3+,您可以使用快捷方式:
$(function() {
$('input').bind('focus', false);
});