我已經實現了comobox,但我的問題是我想爲我的項目實現兩個組合框,並且我想爲它們分配不同的ID,如<select id="size1"
。如何分配id到這<select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6">
,如果我分配id到HTML中的選擇標記我怎麼能做到這一點在jQuery代碼$(".chosen-select").chosen();
如何分配id到選擇標記
我應該改變jQuery代碼,如果我添加ID選擇標籤?
下面是我的代碼
$(function(){
$(".chosen-select").chosen();
});
<link rel="stylesheet" href="http://harvesthq.github.io/chosen/chosen.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="http://harvesthq.github.io/chosen/chosen.jquery.js" type="text/javascript"></script>
<div>
<em>Multiple Select with Groups</em><br />
<select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6">
<option value="" />
<optgroup label="NFC EAST">
<option />Dallas Cowboys
<option />New York Giants
<option />Philadelphia Eagles
<option />Washington Redskins
</optgroup>
<optgroup label="NFC NORTH">
<option />Chicago Bears
<option />Detroit Lions
<option />Green Bay Packers
<option />Minnesota Vikings
</optgroup>
<optgroup label="NFC SOUTH">
<option />Atlanta Falcons
<option />Carolina Panthers
<option />New Orleans Saints
<option />Tampa Bay Buccaneers
</optgroup>
<optgroup label="NFC WEST">
<option />Arizona Cardinals
<option />St. Louis Rams
<option />San Francisco 49ers
<option />Seattle Seahawks
</optgroup>
<optgroup label="AFC EAST">
<option />Buffalo Bills
<option />Miami Dolphins
<option />New England Patriots
<option />New York Jets
</optgroup>
<optgroup label="AFC NORTH">
<option />Baltimore Ravens
<option />Cincinnati Bengals
<option />Cleveland Browns
<option />Pittsburgh Steelers
</optgroup>
<optgroup label="AFC SOUTH">
<option />Houston Texans
<option />Indianapolis Colts
<option />Jacksonville Jaguars
<option />Tennessee Titans
</optgroup>
<optgroup label="AFC WEST">
<option />Denver Broncos
<option />Kansas City Chiefs
<option />Oakland Raiders
<option />San Diego Chargers
</optgroup>
</select>
</div>
感謝,我該怎麼做選擇標籤我的意思是HTTP預期的行爲:// stackoverflow.com/questions/38619548/how-to-choose-the-text-without-selection-in-jquery-chosen-plugin – overflowstack9
我想要這樣http://stackoverflow.com/questions/38619548/how-to-如果你不介意 – overflowstack9
肯定會選擇-text-without-selection-in-jquery-chosen-plugin,我會看看t帽子也... – kukkuz