How layui gets the value of the checkbox and how to assign a value to the checkbox

王林
Release: 2020-11-19 15:32:49
forward
6670 people have browsed it

How layui gets the value of the checkbox and how to assign a value to the checkbox

Get the value of the check box:

(Learning video sharing: javascript video tutorial)

1. Get layui The value of a single check box

=========================================HTML=============================================
========================================JS============================================= var allDayCheck = document.getElementById("AllDay").checked; var isEndCheck = document.getElementById("IsEnd").checked;
Copy after login

2. Layui obtains the values ​​​​of multiple check boxes and centrally transmits them to the background

//HTML代码

//JS代码
Copy after login

So how to assign values ​​to the layui check boxes?

 layui.use('form', function () {
     form = layui.form;
     $('#AllDay').prop("checked", true); //先进行基本赋值                          
     form.render(); //这句必须(用来更新渲染页面)
});
Copy after login

Recommended tutorial: layui

The above is the detailed content of How layui gets the value of the checkbox and how to assign a value to the checkbox. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!