我讀過選定的jquery http://harvesthq.github.io/chosen/。好吧,我想要「隱藏搜索單選」作爲相同的例子(例如在guthub /上面選擇),如FLAG=false
隱藏它們。我該怎麼做?如何隱藏搜索單選select jquery?
var data = [{
"BU_ID": "B01",
"BU_NAME": "Agro Feed",
"BU_DES": "Agro Feed",
"EDIT_DATE": "2015-05-05T00:00:00",
"EDIT_BY": "",
"FLAG": true
}, {
"BU_ID": "B02",
"BU_NAME": "Agro Farm",
"BU_DES": "Agro Farm",
"EDIT_DATE": "2015-05-05T00:00:00",
"EDIT_BY": "",
"FLAG": false
},{
"BU_ID": "B03",
"BU_NAME": "Agro Food",
"BU_DES": "Agro Food",
"EDIT_DATE": "2015-05-05T00:00:00",
"EDIT_BY": "",
"FLAG": true
}
];
$("#cb_info").empty();
$.each(data, function (idx, obj) {
$("#cb_info").append('<option value="' + obj.BU_ID + '">' + obj.BU_NAME + '</option>');
});
$("#cb_info").chosen({ width: "auto" });
$("#cb_info").trigger("chosen:updated");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/chosen/1.0/chosen.css" rel="stylesheet"/>
<script src="http://cdnjs.cloudflare.com/ajax/libs/chosen/1.0/chosen.jquery.js"></script>
<select id="cb_info"></select>
謝謝你們。
還不是很清楚..你可以詳盡地用一個例子單SELECT_ _hide搜索? –
你想隱藏有'Flag:false'的選項嗎? –
親愛的@MKA,完全如您所說。 –