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 has lay- The attributes submit and lay-event are supported, so only the most primitive js and jq can be used to monitor click events.
(Recommended tutorial: layui)
The first one, js monitoring
<button class="layui-icon layui-icon-export" id="withExport"></button>
$(document).on('click',"#withExport",function(){ layer.msg("按钮点击"); });
The second one, jQuery monitoring
<button class="layui-icon layui-icon-export" id="withExport"></button>
$("#withExport").click(function(){ layer.msg("点击事件"); });
The above is the detailed content of How to implement click event in layui. For more information, please follow other related articles on the PHP Chinese website!