jQuery MiniUI

 找回密码
 立即注册
查看: 3013|回复: 3
打印 上一主题 下一主题

onclick携带自定义参数的问题 [复制链接]

Rank: 3Rank: 3

跳转到指定楼层
楼主
发表于 2020-9-22 09:19:53 |只看该作者 |倒序浏览

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)

Rank: 8Rank: 8

沙发
发表于 2020-9-22 10:57:05 |只看该作者
你是如何绑定的事件

Rank: 3Rank: 3

板凳
发表于 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)

Rank: 8Rank: 8

地板
发表于 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>
复制代码
如上代码,可以正常使用

Archiver|普加软件

GMT+8, 2024-11-27 00:37 , Processed in 1.045305 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部