简体   繁体   English

jQuery的:添加现有的 <option>标记<select>标签

[英]JQuery : Add Existing <option> tag in <select> tag

firstly thanks in advance. 首先,先谢谢。 in my jsp page i have two tag . 在我的jsp页面中,我有两个标签。 at run time i want to remove multiple selected options tag and insert these tag into another tag. 在运行时,我想删除多个选定的选项标签,并将这些标签插入另一个标签。 whith following code i have done add and remove one option tag. 以下代码我已经完成添加和删除一个选项标签。

$("input[type=button]").removeAttr("disabled");
    var option =  $('#availableExpert option:selected');
    $('#availableExpert option:selected').remove();
    $('#assignedExpert').append('<option value='+option.val()+'>'+option.text()+'</option>');

how this is done with Multi select options tags ? 多重选择选项标签是如何做到的?

Use 采用

$("input[type=button]").prop("disabled", false);
$('#availableExpert option:selected').detach().appendTo('#assignedExpert');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM