jQuery MiniUI

标题: onclick携带自定义参数的问题 [打印本页]

作者: xiva    时间: 2020-9-22 09:19:53     标题: onclick携带自定义参数的问题


var s =    '<input name="educationSchool" value="EducationSchoolId_VALUE" text="EducationSchoolName_VALUE" required="false" allowInput="false" class="mini-buttonedit w100" />';
然后 mini.parse();
调用    var showSchoolWin = function (e,$w,$h) {
var btnEdit = e.sender;
}
报错
Uncaught ReferenceError: e is not defined
    at eval (eval at <anonymous> (eval at o0o01 (miniui.js:11492)), <anonymous>:1:15)
    at eval (<anonymous>)
    at o0o0ol.eval (eval at o0o01 (miniui.js:11492), <anonymous>:3:87)
    at o0o0ol.llo1 [as fire] (miniui.js:11482)
    at o0o0ol.oOOO1 [as O1oO0] (miniui.js:12682)
    at HTMLSpanElement.<anonymous> (miniui.js:17057)
    at HTMLSpanElement.dispatch (jquery-1.11.3.js:4670)
    at HTMLSpanElement.elemData.handle (jquery-1.11.3.js:4338)


作者: dforce    时间: 2020-9-22 10:57:05

你是如何绑定的事件
作者: xiva    时间: 2020-9-22 14:40:09

dforce 发表于 2020-9-22 10:57
你是如何绑定的事件

var s =    '<input name="educationSchool" value="EducationSchoolId_VALUE" text="EducationSchoolName_VALUE" required="false" allowInput="false" class="mini-buttonedit w100"   onclick="showSchoolWin(e,500,600)"   />';
然后 mini.parse();
调用    var showSchoolWin = function (e,$w,$h) {
var btnEdit = e.sender;
}
报错
Uncaught ReferenceError: e is not defined
    at eval (eval at <anonymous> (eval at o0o01 (miniui.js:11492)), <anonymous>:1:15)
    at eval (<anonymous>)
    at o0o0ol.eval (eval at o0o01 (miniui.js:11492), <anonymous>:3:87)
    at o0o0ol.llo1 [as fire] (miniui.js:11482)
    at o0o0ol.oOOO1 [as O1oO0] (miniui.js:12682)
    at HTMLSpanElement.<anonymous> (miniui.js:17057)
    at HTMLSpanElement.dispatch (jquery-1.11.3.js:4670)
    at HTMLSpanElement.elemData.handle (jquery-1.11.3.js:4338)


作者: dforce    时间: 2020-9-22 14:45:34

xiva 发表于 2020-9-22 14:40
var s =    '';
然后 mini.parse();
调用    var showSchoolWin = function (e,$w,$h) {
  1. <script type="text/javascript">
  2.     mini.parse();
  3.     var s = '<input name="educationSchool" value="EducationSchoolId_VALUE" text="EducationSchoolName_VALUE" required="false" allowInput="false" class="mini-buttonedit w100"   onclick="showSchoolWin(e,500,600)"   />'
  4.     $(document.body).append(s);
  5.     mini.parse();
  6.     var showSchoolWin = function (e, $w, $h) {
  7.         var btnEdit = e.sender;
  8.         alert(e.sender.name+":"+$w + ":" + $h);
  9.     }
  10. </script>
复制代码
如上代码,可以正常使用




欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2