答案 0 :(得分:0)
我相信你正在寻找像Select2这样的东西。这可以将您的fun <- function ( i ) {
ss <- seq ( length ( L [[ i ]] ))
Map ( function ( a , b ) which ( L [[ a ]] [[ b ]] > 1 ) , ss[[ i ]] , MoreArgs = ( a = list ( seq ( length ( L )) )))
}
lapply ( seq ( length ( L )) , fun )
转换为<select>
和<ul>
,不仅如此,还可以为您提供自动提示和其他内容等选项。
如果您想将其转换回来,请使用<li>
。非常简单。
.select2("destroy")
$(function () {
$("select").select2();
});
将演示文稿转换回<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.full.min.js"></script>
<select name="data[Listing][catid][]" class="jr-cat-select jrSelect" size="1">
<option value="0">- Select Category -</option>
<option value="4"> Flat</option>
<option value="5"> House</option>
<option value="7"> Shared Flat</option>
<option value="6"> Shared House</option>
<option value="8"> Studio</option>
</select>
:
<select>
$(function () {
$("select").select2();
$("#remBtn").click(function () {
$("select").select2("destroy");
});
});