Home >Web Front-end >Layui Tutorial >When using layui beautification, retain the change event in the select

When using layui beautification, retain the change event in the select

尚
forward
2019-11-25 15:28:533178browse

When using layui beautification, retain the change event in the select

Many friends have encountered the problem that the change event inside is not triggered after beautification. The previous suggestion was to make full use of layui components since they are used. It also provides corresponding Select event of the form, but if these nodes existed before and later used layui, wouldn't it be necessary to move the corresponding events over?

Recommended: layui usage tutorial

Is there any way to beautify and retain events? The answer is yes, and there are many possible ways. , here is a modification method that I think is the simplest and most convenient for reference.

Rendering:

When using layui beautification, retain the change event in the select

You may not be able to see anything from the picture, but look at the key code. The pop-up information in the picture is actually bound to select The event pops up

When using layui beautification, retain the change event in the selectWhen using layui beautification, retain the change event in the select

Key processing

When using layui beautification, retain the change event in the select

Test code: https://pan. baidu.com/s/1aZj6MnfL5w4FNFryprPqxw

Then if any friends find that after the change, the node selection without adding lay-filter will trigger the original binding event twice. Please also move to what I just mentioned. There is an introduction in the post I came across. This should be a bug in layui itself. My latest modifications are as follows.

When using layui beautification, retain the change event in the select

The two commented lines are the original code. Replace it with the following line. Will the modification have any adverse effects? You can rest assured that this will not have any adverse effects.

The above is the detailed content of When using layui beautification, retain the change event in the select. For more information, please follow other related articles on the PHP Chinese website!

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