IE Error TypeError:无法获取属性“set”的值:object为null或undefined [英] IE Error TypeError: Unable to get value of the property 'set': object is null or undefined
本文介绍了IE Error TypeError:无法获取属性“set”的值:object为null或undefined的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
开发控制台正在显示:
TypeError:无法获取属性set的值:object为null或undefined
在FF或其他浏览器中不会出现此错误。我已经看过这个问题的其他解决方案,没有一个可以解决我的问题。
我已尝试使用页面:
< meta http-equiv =X-UA兼容content =IE = edge>
它失败的JavaScript:
$ b $($$$$$$$$$$$$ do / query,dijit / registry],函数(on,dom,lang,query){
$(document).ready(function(){
var addButton = dijit.byId('addName');
if(addButton){
addButton.on('click',function(evt){
evt .preventDefault();
grid.addRecord('name');
});
}
});
解决方案
在下面进行更改,你应该很好。
//结束时移动dojo / domReady!添加了dojo / ready模块
require([dojo / on,dojo / dom ,dojo / _base / lang,dojo / ready,dojo / query,dijit / registry,dojo / domReady!],
//下面的回调列表应该匹配模块在r
函数(on,dom,lang,ready,query,registry){
// $(document)是指Jquery插件。你使用Jquery
//$(document).ready(function(){
ready(function(){//使用dojo / ready模块
//更改dijit到注册表
// var addButton = dijit.byId('addName');
var addButton = registry.byId('addName');
if(addButton) {
addButton.on('click',function(evt){
evt.preventDefault();
grid.addRecord('name');
} );
}
});
I am getting the following error when i run my web application in IE9. The application is using Struts and DOJO UI.
Development console is showing:
TypeError: Unable to get value of the property 'set': object is null or undefined
This error does not occur in FF or other browsers. I have looked at other solution to this issue and none seems to remedy my problem.
I have tried using tag in the head of my web page:
<meta http-equiv="X-UA-Compatible" content="IE=edge">
The JavaScript which it is failing on:
require(["dojo/on", "dojo/dom", "dojo/_base/lang", "dojo/domReady!", "dojo/query","dijit/registry"],
function (on, dom, lang, query) {
$(document).ready(function () {
var addButton = dijit.byId('addName');
if(addButton){
addButton.on('click', function (evt) {
evt.preventDefault();
grid.addRecord('name');
});
}
});
解决方案
Make the changes below and you should be good to go.
// Moved dojo/domReady! at the end. Added dojo/ready module.
require(["dojo/on", "dojo/dom", "dojo/_base/lang", "dojo/ready", "dojo/query","dijit/registry", "dojo/domReady!" ],
// The callback list below should match the modules in the require statement.
function (on, dom, lang, ready, query, registry) {
// $(document) refers to Jquery plugin. Are you using Jquery
//$(document).ready(function () {
ready(function () { // using the dojo/ready module.
// changed dijit to registry
//var addButton = dijit.byId('addName');
var addButton = registry.byId('addName');
if(addButton){
addButton.on('click', function (evt) {
evt.preventDefault();
grid.addRecord('name');
});
}
});
这篇关于IE Error TypeError:无法获取属性“set”的值:object为null或undefined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文