Home >Web Front-end >Layui Tutorial >How to use button events in layui

How to use button events in layui

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-07-11 16:17:0820870browse

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!

Statement:
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