How to backfill the value selected in layui drop-down

angryTom
Release: 2019-07-29 17:01:30
Original
3087 people have browsed it

How to backfill the value selected in layui drop-down

If you want to know more about layui, you can click: layui tutorial

##layui gets the value in the check box and backfills

layui gets the value in the check box (get multiple, separated by commas)

let  zxbm= document.getElementsByName("zxbm");
		    let check_val = [];
		    for(k in zxbm){
		        if(zxbm[k].checked)
		            check_val.push(zxbm[k].value);
		    }
		   let zxbmcheck=check_val.join(",");
Copy after login

layui checkbox backfill

  var apv = res.data.zxyj.split(","); //将数据以,(逗号)分割形成数组(res.data.zxyj是从后台获取到的数据(形如:1,2,3))
				$("[name=zxbm1]:checkbox").prop("checked", false); 
				if(apv != "") {
					for(var i = 0; i < apv.length; i++) {
						$("[name=zxbm1][value=" + apv[i] + "]").prop("checked", true);
					}
				}
Copy after login

The above is the detailed content of How to backfill the value selected in layui drop-down. 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