Layui SELECT OPTION Solution Solution

Xiaobian I used Layui, in Select’s place, the value in Select could not be emptied, and the option in Select also has an overlay problem. In order to solve this problem, I also reach my function, I have studied it. Let the small partners who have the same needs do not step on the pit, special post on my source:

    Layui - pull-down frame linkage test     Select box    
time
The amount
Select box Please select a rule name
// The data passed by the background VAR DATA = [{UnitType: 0, Rulename: 'Time Rule 11' Amount: 1100, Money: 1100}, {UnitType: 0, Rulename: 'Time Rule 12', Amount: 1200, Money: 1200}, {UnitType: 0, Rulename: 'Time Rule 13', Amount: 1300, Money : 1300}, {UNITTYPE: 1, Rulename: 'amount Rule 21', Amount: 2100, Money: 2100}, {UnitType: 1, Rulename: 'amount rules 22', Amount: 2200, Money: 2200}, {UnitType : 1, Rulename: 'Amount Rule 23', Amount: 2300, Money: 2300},]; // Initialization Default is time type and corresponding time rules Layui.use ('form', function () {var form = layui.form; $ ('# test2'). Html (''); VAR html = ''; $ .each (Data, Function (i, e) {if (e.Unittype == 0) HTML + = ` $ {E.Rulename} `;}) $ (' # Test2 '). Append (HTML); Form.render (' select ');}) // Dynamic secondary linkage Layui.use (' form ', function () {var form = layui.form; Form.on 'SELECT (TEST1)', FUNCTION (OBJ) {$ ('# test2'). HTML (''); var html = ''; if (obj.value == 0) {$ .each (data, function) i, e) {if (e.Unittype == obj.value) html + = `
$ {E.Rulename}
`;}) $ ('# Test2'). append (html);} else IF (Obj.Value == 1) {$ .each (Data, Function (i, e) {if (e.Unittype == obj.value) HTML + = `
$ {E.Rulename} The solution of the Option overlay of the select of Layui is the total content of Xiaobian sharing to everyone. I hope I can give you a reference, I hope everyone will support it. Tumi cloud.
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment