firefox中未定义event.type
event.type undefined in firefox
我有以下功能:
format : function(element,p){
//function body
if(event.type == 'focus'){
//execute this condition only on focus event
}
}
在焦点事件和页面加载时调用。element是输入元素的值,p是一个可选的参数,我想只对输入元素的焦点执行if。如果我只是简单地应用event.type=='focus',它适用于IE和chrome,但对于firefox,它表示未定义事件。
有人能解决这个问题吗?提前谢谢。
var myObj = {
format: function (event) {
// passing in the event object should give you everything you need:
// event.type (the event's type)
// event.target (the element which the event was fired on)
// event.which (in the case of keyboard events, this is the key that was pressed)
// see mdn dox @ https://developer.mozilla.org/en-US/docs/Web/API/Event
if (event.type === 'focus') {
// execute focus code
}
}
};
相关文章:
- 如何将输入(type=text)从html表单传递到javascript函数
- issue with FB.Event.subscribe
- 正在将base64 jpeg从input-type=file上传到服务器
- Angularjs :$routeChangeStart event
- event.prventDefault()持续多久
- <text区域>在我的html中包含event.keycode==13之后,wrap就不起作用了
- 类型错误'未定义'不是对象(正在评估'navigator.connection.type'
- <输入id=“;“到期”;type=“;月份;min=“;2016-05”>如何填写“;min”;属性与当前
- angular type=[number]指令来阻止粘贴
- KeyDown event for CKeditor
- 节点,express应用程序返回text/javascript响应头(Content-Type),尽管设置了applic
- 未捕获错误:语法错误,无法识别的表达式:input[@type=submit]
- Javascript events: window.event vs argument reference (funct
- 动态填充Bootstrap选择选择器:change event dos'不起作用
- <td> focusin event .addclass
- 如何停止向上滚动<按钮dojoType=“;dijit.form.Button”;type=“;提交”/>在
- type=text/javascript和language=javascript之间的区别
- event.preventDefault阻止ajax调用
- firefox中未定义event.type
- Gulp watch:根据event.type有条件地运行任务