日期:2014-05-16  浏览次数:20354 次

jquery focus怎么失效啊??在事件里面
        $("#txt").change(function () {
            $(this).focus();
        });


这代码没问题吧,怎么调用focus就是没效啊···

------解决方案--------------------
firefox和chrome没用,可能事件冲突了,ie可以。。改成下面就行。。

        $("#txt").change(function () {
            var me = this;
            setTimeout(function () { $(me).focus(); }, 1);
        });

------解决方案--------------------
测试了下,失去焦点后的事件,如onblur,onchange这种,事件体中使用获取焦点的事件除了ie有效果,其他浏览器都不行。。
------解决方案--------------------
$("#txt").blur(function () {
//这里判断
             $(this).focus();
         });