基于PCASClass.js和layui.js的城市三级联动
2021-01-23 19:13
标签:public ntb ext styles text orm pca line code 基于PCASClass.js和layui.js的城市三级联动 标签:public ntb ext styles text orm pca line code 原文地址:https://www.cnblogs.com/superfeeling/p/13276853.htmlDOCTYPE html>
html>
head>
meta charset="UTF-8">
link rel="stylesheet" href="../Public/js/layui/css/layui.css" />
title>title>
head>
body>
div class="layui-form">
div class="layui-form-item">
label class="layui-form-label">城市label>
div class="layui-input-inline">
select id="province" name="org_province" lay-filter="org_province">
select>
div>
div class="layui-input-inline">
select id="city" name="org_city" lay-filter="org_city">
select>
div>
div class="layui-input-inline">
select id="area" name="org_area" lay-filter="org_area">
select>
div>
div>
div>
script type="text/javascript" src="../Public/js/layui/layui.js">script>
script type="text/javascript" src="../Public/js/PCASClass.js">script>
body>
script>
var mypcas = new PCAS("org_province", "org_city", "org_area", "请选择省份", "请选择城市", "请选择地区");
layui.use([‘form‘], function() {
var form = layui.form;
var province;
form.on(‘select(org_province)‘, function(data) {
province = data.value;
//不清除的话,layui高版本会出现选项重复
document.getElementById("province").innerHTML="";
document.getElementById("city").innerHTML="";
document.getElementById("area").innerHTML="";
var mypcas = new PCAS("org_province", "org_city", "org_area", province, "请选择城市", "请选择地区");
form.render(‘select‘);
});
form.on(‘select(org_city)‘, function(data) {
//不清除的话,layui高版本会出现选项重复
document.getElementById("province").innerHTML="";
document.getElementById("city").innerHTML="";
document.getElementById("area").innerHTML="";
var mypcas = new PCAS("org_province", "org_city", "org_area", province, data.value, "请选择地区");
form.render(‘select‘);
});
});
script>
html>
文章标题:基于PCASClass.js和layui.js的城市三级联动
文章链接:http://soscw.com/index.php/essay/45994.html