Note: The click event here refers to a simple click event, not a submission event, or a button embedded in the data table. For both of these, layui supports the attributes lay-submit and lay-event, so Only the most primitive js and jq can be used to monitor click events.
(Recommended tutorial: layui official website address )
The first type, js monitoring
<button class="layui-icon layui-icon-export" id="withExport"></button>
$(document).on('click',"#withExport",function(){
layer.msg("按钮点击");
});
The second type, jQuery monitoring
<button class="layui-icon layui-icon-export" id="withExport"></button>
$("#withExport").click(function(){
layer.msg("点击事件");
});