jQuery将MultiSelect值移动到另一个MultiSelect [英] jQuery moving MultiSelect values to another MultiSelect

查看:52
本文介绍了jQuery将MultiSelect值移动到另一个MultiSelect的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个x值的MultiSelect框,我需要能够移动到另一个MultiSelect框,反之亦然.

So I have a MultiSelect box with x values which I need the ability to move to another MultiSelect box and vise versa.

<select class="boxa" multiple="multiple">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>

<select class="boxb" multiple="multiple">

</select>

在单击按钮时需要将boxa的所有值或其中之一移到boxb,还需要将这些值从boxb移回到boxa.

Need to move all or one of the values of boxa to boxb on a button click, also with the ability to move the values back from boxb to boxa.

jQuery是否具有类似的功能,或者这是自定义的代码段?

Does jQuery have anything like this or is this a custom snippet of code?

推荐答案

有一个名为 crossSelect 的jquery插件.一个>这似乎在做你想要的.

There's a jquery plugin called crossSelect which seems to do what you want.

jQuery没有内置此功能,您需要找到自己喜欢的插件并使用它,或者编写自己的插件. (当然,您不必使用jQuery来编写或使用它,如果愿意,可以使用纯JavaScript实现)

jQuery doesn't have this built in, you would need to either find a plugin you like and use that, or write your own. (And of course you don't have to use jQuery to write or use it, you could implement it in pure javascript if you like)

这篇关于jQuery将MultiSelect值移动到另一个MultiSelect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆