我正在努力扩展一些旧的dojo代码(v1.8)。我添加了一个按钮,单击该按钮可调用简单的句柄功能。问题是,当我单击按钮并且在Firebug中收到以下错误时,什么也没有发生:
TypeError: matchesTarget is undefined
之前一切都可以正常工作,我只添加了以下代码:
require(["dojo/on"], function (on) {
on(document.getElementById("submitBtn"), "button:click", function (e) {
onSubmitQuery();
});
});
onSubmitQuery:function () {
var model_type_uuid = document.getElementById("modelTypeSelect").get('value');
// check to see if model_type_uuid is not undefined before submitting
if (model_type_uuid === undefined || model_type_uuid == "00000000-0000-0000-0000-000000000000") {
alert('Invalid Decision Model Type ' + model_type_uuid + ' for Decision Query submission');
return;
}
if (document.getElementByID("modeSelector").get('value') == "simulate") {
submitStandingQuery(model_type_uuid);
} else {
submitInteractiveQuery(model_type_uuid);
}
}
我一直在想办法解决问题。请帮忙!
您需要添加dojo/query
模块以便button
在其父节点内匹配选择器submitBtn
。
require(["dojo/on", "dojo/query"], function (on) {
on(document.getElementById("submitBtn"), "button:click", function (e) {
onSubmitQuery();
});
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句