The three-level linkage of provinces, cities and autonomous regions of layui does not work in iframe.

province.js

var defaults = {

s1: "provid",
s2: "cityid",
s3: "areaid",
v1: null,
v2: null,
v3: null

};
var $form;
var form;
var $;
layui.define (["jquery"," form"], function () {

$ = layui.jquery;
form = layui.form;
$form = $("form");
treeSelect(defaults);

});
function treeSelect (config) {

config.v1 = config.v1 ? config.v1 : 110000;
config.v2 = config.v2 ? config.v2 : 110100;
config.v3 = config.v3 ? config.v3 : 110101;
$.each(threeSelectData, function (k, v) {
    appendOptionTo($form.find("select[name=" + config.s1 + "]"), k, v.val, config.v1);
});
form.render();
cityEvent(config);
areaEvent(config);
form.on("select(" + config.s1 + ")", function (data) {
    cityEvent(data);
    form.on("select(" + config.s2 + ")", function (data) {
        areaEvent(data);
    });
});

function cityEvent(data) {
    $form.find("select[name=" + config.s2 + "]").html("");
    config.v1 = data.value ? data.value : config.v1;
    $.each(threeSelectData, function (k, v) {
        if (v.val == config.v1) {
            if (v.items) {
                $.each(v.items, function (kt, vt) {
                    appendOptionTo($form.find("select[name=" + config.s2 + "]"), kt, vt.val, config.v2);
                });
            }
        }
    });

    form.render();
    config.v2 = $("select[name=" + config.s2 + "]").val();
    areaEvent(config);
}
function areaEvent(data) {
    $form.find("select[name=" + config.s3 + "]").html("");
    config.v2 = data.value ? data.value : config.v2;
    $.each(threeSelectData, function (k, v) {
        if (v.val == config.v1) {
            if (v.items) {
                $.each(v.items, function (kt, vt) {
                    if (vt.val == config.v2) {
                        $.each(vt.items, function (ka, va) {
                            appendOptionTo($form.find("select[name=" + config.s3 + "]"), ka, va, config.v3);
                        });
                    }
                });
            }
        }
    });

    form.render();
    form.on("select(" + config.s3 + ")", function (data) { });
}
function appendOptionTo($o, k, v, d) {
    var $opt = $("<option>").text(k).val(v);
    if (v == d) { $opt.attr("selected", "selected") }
    $opt.appendTo($o);
}

}

            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline">
                    <select name="provid" id="provid" lay-filter="provid">
                        <option value=""></option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="cityid" id="cityid" lay-filter="cityid">
                        <option value=""></option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="areaid" id="areaid" lay-filter="areaid">
                        <option value="">/</option>
                    </select>
                </div>
            </div>
Apr.21,2021

has been resolved. Layui version and jquery version compatibility


get a number instead of a place name

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e467ab-44b96.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e467ab-44b96.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?