How to implement click event in layui

王林
Release: 2020-10-14 17:59:08
forward
6282 people have browsed it

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>
Copy after login
$(document).on(&#39;click&#39;,"#withExport",function(){
        layer.msg("按钮点击");
 });
Copy after login

The second one, jQuery monitoring

<button class="layui-icon layui-icon-export" id="withExport"></button>
Copy after login
$("#withExport").click(function(){
	layer.msg("点击事件");
});
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template