dojo on.js TypeError matchesTarget 未定义

dojo on.js TypeError matchesTarget is undefined

我正在努力扩展一些遗留的 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 模块以在其父节点 submitBtn.

中匹配选择器 button
require(["dojo/on", "dojo/query"], function (on) {
  on(document.getElementById("submitBtn"), "button:click", function (e) {
    onSubmitQuery();
  });
});