Home >Web Front-end >Layui Tutorial >How to implement click event in layui

How to implement click event in layui

王林
王林forward
2020-10-14 17:59:086325browse

How to implement click event in layui

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(&#39;click&#39;,"#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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete