在layui框架中使用form.on方法绑定select下拉框选中事件,form.on()方法不执行, 解决方法有以下几点:

1.  html中form标签中要有class="layui-form",否则不生效

<form class="layui-form">

</form>
 2.  form.on方法必须放在layui.use({})里

<script language="JavaScript">
layui.use(['form', 'layer'], function () {
form.on('select(XXX)', function (data) {});
});
3.  select标签中要有lay-filter属性,用来监听select

<select lay-search>
<option></option>
</select>
以上解决方法就能使form.on方法执行了

相关文章:

  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-25
  • 2021-11-27
  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案