0
我有一個複選框值列表。我的目標是允許用戶點擊每個值的整個彩色框(即,複選框將在單擊複選框,名稱和整個彩色框時標記)。我有點成就,但不知何故複選框框懸停在中間顯示。複選框值列表的選擇和刪除
這裏我BOOTPLY - BOOTPLY
$("#clear").change(function() {
$("input:checkbox").prop('checked', $(this).prop("checked"));
});
<div class="btn-toolbar">
<!--Default buttons with dropdown menu-->
<div class="btn-group">
<button class="btn btn-default" type="button">Brand</button>
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button"><span class="caret"></span></button>
<div class="dropdown-menu scrollable-menu" style="margin-left: 2em">
<input class="typeahead" placeholder="Search values" type="text">
\t \t \t \t <div class="checkbox">
<label><input value="" type="checkbox"> Alpha</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Beta
</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Gamma</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Delta</label>
</div>
\t \t \t \t <div class="checkbox">
<label><input value="" type="checkbox"> Omega</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Koppa
</label>
</div>
\t \t \t \t <div class="div_form">
\t \t \t \t \t \t \t <span class="btn_apply" id="apply">Apply</span>
<span class="btn_clear"><input id="clear" type="checkbox">Clear</span>
\t \t \t \t \t </div>
</div>
</div><!--Primary buttons with dropdown menu-->
<div class="btn-group">
<button class="btn btn-primary" type="button">Colour</button>
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown" type="button"><span class="caret"></span></button>
<div class="dropdown-menu scrollable-menu" style="margin-left: 2em">
\t \t \t \t <input class="typeahead" placeholder="Search values" type="text">
<div class="checkbox">
<label><input value="" type="checkbox"> Eins</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Zwei
</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Drei</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Vier</label>
</div>
\t \t \t \t <div class="checkbox">
<label><input value="" type="checkbox"> Fünf</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Sechs
</label>
</div>
\t \t \t \t <div class="div_form">
\t \t \t \t \t \t \t <span class="btn_apply" id="apply">Apply</span>
\t \t \t \t \t \t \t <span class="btn_clear"><input id="clear" type="checkbox">Clear</span>
\t \t \t \t \t </div>
</div>
</div><!--Info buttons with dropdown menu-->
<div class="btn-group">
<button class="btn btn-info" type="button">Merchant</button>
<button class="btn btn-info dropdown-toggle" data-toggle="dropdown" type="button"><span class="caret"></span></button>
<div class="dropdown-menu scrollable-menu" style="margin-left: 2em">
\t \t \t \t <input class="typeahead" placeholder="Search values" type="text">
<div class="checkbox">
<label><input value="" type="checkbox"> First value</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Second option
</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Third choice</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Fourth alternative</label>
</div>
\t \t \t \t <div class="checkbox">
<label><input value="" type="checkbox"> Fifth decision</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Sixt focus
</label>
</div>
\t \t \t \t <div class="div_form">
\t \t \t \t \t \t \t <span class="btn_apply" id="apply">Apply</span>
\t \t \t \t \t \t \t <span class="btn_clear"><input id="clear" type="checkbox">Clear</span>
\t \t \t \t \t </div>
</div>
</div><!--Success buttons with dropdown menu-->
<div class="btn-group">
<button class="btn btn-danger" type="button">Price</button>
<button class="btn btn-danger dropdown-toggle" data-toggle="dropdown" type="button"><span class="caret"></span></button>
<div class="dropdown-menu scrollable-menu" style="margin-left: 2em">
\t \t \t \t <input class="typeahead" placeholder="Search values" type="text">
<div class="checkbox">
<label><input value="" type="checkbox"> Value-1</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Value-2
</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Value-3</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Value-4</label>
</div>
\t \t \t \t <div class="checkbox">
<label><input value="" type="checkbox"> Value-5</label>
</div>
<div class="checkbox">
<label><input value="" type="checkbox"> Value-6
</label>
</div>
\t \t \t \t <div class="div_form">
\t \t \t \t \t \t \t <span class="btn_apply" id="apply">Apply</span>
\t \t \t \t \t \t \t <span class="btn_clear"><input id="clear" type="checkbox">Clear</span>
\t \t \t \t \t </div>
</div>
</div>
</div><!--Success buttons with dropdown menu-->
+1到特麗克絲上SOF。 changin寬度正在糾正問題,但懸停不會超過整行只是背景紅色標籤元素,而不是整個div容器。 – pratikpawar
我會再看看,thnx通知 – Trix
@Trix - 我同意SOF。但是,pratikwebdev指出,您的解決方案對我不起作用。 – raulbaros