【求助】【找个jquery】点击展开下拉框并多选,然后将选中的值post到处理页面

hgwyl 2020-10-07 04:41:45

需求:点击展开下拉框并多选,然后将选中的值post到处理页面
//基本结构如下
<form method="post" action="testarray.php">
//这里需要放入一个类似input的东西,点击后展开,进行多选,name="content_array"
<input type="submit" value="点击传递选项值">
</form>

//testarray.php页面可以
$content_array=$_POST["content_array"];
...全文
1532 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_50944805 2020-10-08
  • 打赏
  • 举报
回复
白嫖分数,我喜欢
hgwyl 2020-10-07
  • 打赏
  • 举报
回复
自己换了一个方式来解决。 因为另外还有个edit页面,到时候要判断是否已经选中。 用这些插件很难改,干脆全部重写了。 具体是设置一个按钮,点击显示或隐藏<div>,<div>里面按照原始方式写<input type="checkbox"> 来人接分吧~
hgwyl 2020-10-07
  • 打赏
  • 举报
回复
我现在用了EasyUI。实际操作中,发现只是post了最后一个多选值
<!DOCTYPE html>
<html>
<head>
	<title>测试01</title>
    <meta charset="UTF-8">

    <link rel="stylesheet" type="text/css" href="EasyUI/easyui.css" />
    <script type="text/javascript" src="EasyUI/jquery.min.js"></script>
    <script type="text/javascript" src="EasyUI/jquery.easyui.min.js"></script>

<style type="text/css">
</style>

    <script type="text/javascript">
        $(function () {
            $('#ddlLine').combotree({
                valueField: "id", //Value字段
                textField: "text", //Text字段
                multiple: true,
                data: [{ "id": 1, "text": "All", "children": [{ "id": 13, "text": "C1" }, { "id": 14, "text": "C2" }, { "id": 15, "text": "C3"}]}]
,
                //                url: "tree_data2.json", //数据源
                onCheck: function (node, checked) {
                    //让全选不显示
                    $("#ddlLine").combotree("setText", $("#ddlLine").combobox("getText").toString().replace("全选,", ""));
                },
                onClick: function (node, checked) {
                    //让全选不显示
                    $("#ddlLine").combotree("setText", $("#ddlLine").combobox("getText").toString().replace("全选,", ""));
                }
            });
        })
    </script>
</head>
<body>

<form method="post" action="testarray.php">
    多选:<select id="ddlLine" class="easyui-combotree" name="content_array" style="width: 205px; height: 24px;">
    </select>
<input type="submit" value="传递选项值">
</form>

</body>
</html>

87,917

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧