2016-08-06 59 views
2

我想要實現的邊界爲低於2的jQuery選擇組合框像下面的圖片我想使邊框下面的2個搜索框 image如何添加邊框,這些2個組合框

$(".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=""></option> 
 
    <optgroup label="NFC EAST"> 
 
     <option>Dallas Cowboys</option> 
 
     <option>New York Giants</option> 
 
     <option>Philadelphia Eagles</option> 
 
     <option>Washington Redskins</option> 
 
    </optgroup> 
 
    
 
    </select> 
 
    
 
    <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6"> 
 
    <option value=""></option> 
 
    <optgroup label="NFC EAST"> 
 
     <option>Dallas Cowboys</option> 
 
     <option>New York Giants</option> 
 
     <option>Philadelphia Eagles</option> 
 
     <option>Washington Redskins</option> 
 
    </optgroup> 
 
    
 
    </select>

+1

這樣https://jsfiddle.net/9Lrh8wqq/? –

+0

@米創意是你的權利 – overflowstack9

+1

@ overflowstack9你可以使用feildset,它是好得多這個http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_fieldset –

回答

1

$(".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 style="border: medium solid; 
 
max-width: 354px; 
 
padding: 20px;"> 
 
    
 
    <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=""></option> 
 
    <optgroup label="NFC EAST"> 
 
     <option>Dallas Cowboys</option> 
 
     <option>New York Giants</option> 
 
     <option>Philadelphia Eagles</option> 
 
     <option>Washington Redskins</option> 
 
    </optgroup> 
 
    
 
    </select> 
 
    
 
    <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6"> 
 
    <option value=""></option> 
 
    <optgroup label="NFC EAST"> 
 
     <option>Dallas Cowboys</option> 
 
     <option>New York Giants</option> 
 
     <option>Philadelphia Eagles</option> 
 
     <option>Washington Redskins</option> 
 
    </optgroup> 
 
    
 
    </select>

+1

它的工作...... .... – overflowstack9

2

請嘗試下面的代碼。

$(".chosen-select").chosen();
.sel-div{ 
 
    border:1px solid #000; 
 
    padding:10px; 
 
    width:400px; 
 
}
<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 class="sel-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=""></option> 
 
    <optgroup label="NFC EAST"> 
 
     <option>Dallas Cowboys</option> 
 
     <option>New York Giants</option> 
 
     <option>Philadelphia Eagles</option> 
 
     <option>Washington Redskins</option> 
 
    </optgroup> 
 
    
 
    </select> 
 
    
 
    <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6"> 
 
    <option value=""></option> 
 
    <optgroup label="NFC EAST"> 
 
     <option>Dallas Cowboys</option> 
 
     <option>New York Giants</option> 
 
     <option>Philadelphia Eagles</option> 
 
     <option>Washington Redskins</option> 
 
    </optgroup> 
 
    
 
    </select> 
 
    </div>

+1

庫馬爾是啊,你的工作可觀 – overflowstack9

+0

無關的評論:請不要建議編輯做什麼都不做,除非改變鏈接的降價格式。你的編輯是有害的,因爲他們鏈接到github.com/foo/bar看起來像一個鏈接到github.com。 –

0

這是更好

<!DOCTYPE html> 
 
<html> 
 
<body> 
 

 
<form> 
 
<fieldset> 
 
    <legend>Personalia:</legend> 
 
    Name: <input type="text"><br> 
 
    Email: <input type="text"> 
 
</fieldset> 
 
</form> 
 

 
</body> 
 
    
 
</html>