gpt4 book ai didi

javascript - .live() 中的 jQuery .select() 在 IE7 和 IE8 上不起作用

转载 作者:行者123 更新时间:2023-11-29 10:21:32 25 4
gpt4 key购买 nike

jQuery(document).ready(function($) {
$('input[type="text"]').live('focus', function() {
if (this.value == 'someValue') {
this.select();
}
});
});

.delegate().on() 的结果相同。

我错过了什么?

感谢任何帮助。

最佳答案

使用 .on 对我来说效果很好。也许您希望它在您单击时选择文本?

$("form").on("click", ":text", function(){
if ( $(this).val() === "someValue" ) {
$(this).select();
}
});​

fiddle :http://jsfiddle.net/jonathansampson/nfKm7/

关于javascript - .live() 中的 jQuery .select() 在 IE7 和 IE8 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10926808/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com