How to use button events in layui

爱喝马黛茶的安东尼
Release: 2019-07-11 16:17:08
Original
20788 people have browsed it

How to use button events in layui

First we create a layui button.

How to use button events in layui

To use the button event, we can directly add an onclick attribute and add the called function, clickme.

How to use button events in layui

Just define the function clickme. The code is shown in the figure.

How to use button events in layui

Run the page and you will see a button, click this button.

How to use button events in layui

Related recommendations: "layui framework tutorial"

After clicking, the click event can be triggered and run our function The code for the pop-up window.

How to use button events in layui

In addition to adding onclick events directly, we can also use jquery to register events for buttons.

First remove onclick, and then add an id to the button.

(You need to introduce the jquery file first.

How to use button events in layuiHow to use button events in layui

Use jquery to register the event and write the event function.

How to use button events in layui

Run the page again and click the button. You can see that the click event can also be triggered.

How to use button events in layui

The above is the detailed content of How to use button events in layui. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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