formSelects多选框

formSelects多选框

css文件


选择框容器

<% =pkidlist%>为从后台获取的选项数据,如下

public string pkidlist = "";
protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        DataSet dst = new BLL.ytj_parkinfo().GetList("");
        StringBuilder str = new StringBuilder();
        for (int a = 0; a < dst.Tables[0].Rows.Count; a++)
        {
            str.Append("");
        }
        pkidlist = str.ToString();
    }
}

加载模块

layui.config({
    base: '../../../js/' //此处路径请自行处理, 可以使用绝对路径
}).extend({
    formSelects: 'formSelects-v4'
});
var formSelects;
layui.use(['jquery', 'formSelects', 'form'], function () {
    layui.form.render("select");
    formSelects = layui.formSelects;
});
data: {
    "parkidlist": formSelects.value('parkidlist', 'valStr') //valStr获取value值并逗号隔开
}

你可能感兴趣的:(前端,layui)