[英]jQuery .select() inside .live() does not work on IE7 and IE8
jQuery(document).ready(function($) {
$('input[type="text"]').live('focus', function() {
if (this.value == 'someValue') {
this.select();
}
});
});
与.delegate()和.on()相同的结果。
我错过了什么?
任何帮助表示赞赏,谢谢!
使用.on
对我来说.on
。 也许您希望它在您单击时选择文本?
$("form").on("click", ":text", function(){
if ( $(this).val() === "someValue" ) {
$(this).select();
}
});
演示: http : //jsfiddle.net/hjgZ3/
从function($)
删除$
function($)
<input type="text" value="someValue" />
$(function(){
$('input[type="text"]').live('focus', function() {
if (this.value == 'someValue') {
alert('hi');
//this.select();
}
});
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.