jquery多重选择从两个选择变成一个选择?
我试图弄清楚如何创建一个多选表单,该表单具有两个选择,允许您将条件移至第三个选择。我确实看过:
http://www.quasipartikel.at/multiselect/
和
/ /http://www.erichynds.com/jquery/ jquery-multiselect-plugin-with-themeroller-support/ (我是新人,所以我只能发布一个链接...:-))
但它们看起来都只允许一对一选择,而不是我想要的二对一选择实施...
像这样:
<!-- user selects multiple values from this and the selected options are moved to third select onclick -->
<select id="select1" name="select1[]" multiple="multiple">
<option value="1">1</option>
<option value="1">1</option>
<option value="1">1</option>
<option value="1">1</option>
<option value="1">1</option>
</select>
<!-- user also selects multiple values from this and the selected options are moved to third select onclick -->
<select id="select2" name="select2[]" multiple="multiple">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option value="d">d</option>
<option value="e">e</option>
</select>
<!-- this is the target for the previously selected options -->
<select id="target" name="target[]" disabled>
<!-- all of the selected options from select1 and select2 are placed here onclick -->
</select>
这可能吗?有谁有一个有效的示例,或者说明此类事情的链接?
I'm trying to figure out how to create a multiselect form that has two selects that allow you to move criteria into a third select. I did take a look at:
http://www.quasipartikel.at/multiselect/
and
//http://www.erichynds.com/jquery/jquery-multiselect-plugin-with-themeroller-support/
(I'm new, so I can only post one link... :-) )
but they both look like they only allow a one-to-one selection, rather than the two-to-one that I'd like to implement...
Something like this:
<!-- user selects multiple values from this and the selected options are moved to third select onclick -->
<select id="select1" name="select1[]" multiple="multiple">
<option value="1">1</option>
<option value="1">1</option>
<option value="1">1</option>
<option value="1">1</option>
<option value="1">1</option>
</select>
<!-- user also selects multiple values from this and the selected options are moved to third select onclick -->
<select id="select2" name="select2[]" multiple="multiple">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option value="d">d</option>
<option value="e">e</option>
</select>
<!-- this is the target for the previously selected options -->
<select id="target" name="target[]" disabled>
<!-- all of the selected options from select1 and select2 are placed here onclick -->
</select>
Is this possible? Does anyone have a working example, or a link that illustrates this kind of thing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要一个 id 为“add”的按钮,
进行选择并点击添加按钮
,并将此代码附加到按钮上
You need a button with an id of 'add"
make selections hit the add button
with this code attached to the button
您可以根据您的需要进行定制:
它从下拉列表中查找选定的项目,将其删除,然后将其附加到目标下拉列表中。
You may be able to tailor this to your needs:
It finds the selected item from the dropdown, removes it, and appends it to the target dropdown.