js 获取事件对象

js 获取事件对象

e = e || window.event || arguments.callee.caller.arguments[0];

 实例:

 //监听聚焦事件
                $(el).focus(function(e){
                    if (me.focus_callback && typeof me.focus_callback === 'function') {
                        e = e || window.event || arguments.callee.caller.arguments[0];
                        //this:<input id="phone" name="mobile" class="txt-phone txt-erro" type="text" value="19012340000" placeholder="请输入联系电话">
                        me.focus_callback(e,this);
                    }
                    me.clearError&&me.clearError();
                })

猜你喜欢

转载自hw1287789687.iteye.com/blog/2297844
今日推荐