【问题标题】:JQuery : Add Existing <option> tag in <select> tagJQuery:在 <select> 标记中添加现有的 <option> 标记
【发布时间】:2013-05-02 15:23:29
【问题描述】:

首先提前感谢。 在我的 jsp 页面中,我有两个标签。在运行时我想删除多个选定的选项标签并将这些标签插入另一个标签。通过以下代码,我完成了添加和删除一个选项标签。

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

多选选项标签如何做到这一点?

【问题讨论】:

    标签: javascript jquery html css


    【解决方案1】:

    使用

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-17
      • 2012-08-17
      • 1970-01-01
      • 2019-07-30
      • 1970-01-01
      • 1970-01-01
      • 2011-12-24
      • 2010-12-03
      相关资源
      最近更新 更多