jQuery(document).ready(function($) {
$('input[type="text"]').live('focus', function() {
if (this.value == 'someValue') {
this.select();
}
});
});
中 的 每 一 个.delegate()
和 .on()
的 结果 相同 。
我 错过 了 什么 ?
任何 帮助 都 是 感激 不尽 的 。
3条答案
按热度按时间uqjltbpv1#
使用
.on
对我来说很好用。也许你想让它在你点击的时候选择文本?小提琴:http://jsfiddle.net/jonathansampson/nfKm7/
nbysray52#
它确实起作用了,当使用
focus
事件时,文本一旦被选中,就会被取消选中使用
on()
和focus
以外的事件似乎效果更好see this fiddle
nzkunb0c3#
演示 : http://jsfiddle.net/hjgZ3/
从
function($)
中 删除$
中 的 每 一 个