簡體   English   中英

有沒有簡單的方法來克隆現有的所選選擇框?

[英]Is there an easy way to clone an existing chosen select box?

能夠使用值克隆下拉列表。 它在第一行中工作正常,但是當我單擊glyphicon克隆另一行時,下拉控件凍結(什么都沒有發生)。

@Html.DropDownList("searchfieldsDropdownList", new SelectList(Model.DataDictionary, "ID", "BLSName"), "", new { @class = "**chosen-select**" })

$("**.chosen-select**").chosen();

$(".glyphicon-plus").click(function () {
    $(this).closest("tr").clone(true).appendTo("#ruleTable");});

在此處輸入圖片說明

插入新選擇后初始化插件

就像是:

$(".glyphicon-plus").click(function () {
   var $row = $(this).closest("tr").clone(true).appendTo("#ruleTable");
   $row.find('.chosen-select').chosen()
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM