我想在我的網絡中製作按鈕式過濾器。現在,我只是把單選按鈕過濾器放在盒子裏面,但我想刪除單選按鈕,只需點擊盒子就可以使過濾器工作。
的代碼看起來是這樣的現在:
<div class="question-header" data-bind="visible: jobQuestions().length > 0">
<div class="col-sm-3" id="filter-1">
<div class="panel-body">
<input type="radio" value="new" data-bind="checked: jobQuestionsFilter" class="" />
New Questions
(<span data-bind="text: newJobQuestionsCount"></span>)
</div>
</div>
<div class="col-sm-3" id="filter-2">
<div class="panel-body"">
<input type="radio" value="ignored" data-bind="checked: jobQuestionsFilter" />
Ignored Questions
(<span data-bind="text: ignoredJobQuestionsCount"></span>)
</div>
</div>
<div class="col-sm-3" id="filter-3">
<div class="panel-body">
<input type="radio" value="answered" data-bind="checked: jobQuestionsFilter" />
Answered Questions
(<span data-bind="text: answeredJobQuestionsCount"></span>)
</div>
</div>
<div class="col-sm-3" id="filter-4">
<div class="panel-body">
<input type="radio" value="all" data-bind="checked: jobQuestionsFilter" />
All Questions
(<span data-bind="text: allJobQuestionsCount"></span>)
</div>
</div>
</div>
我有什麼解決?
當我嘗試它徘徊,整個箱變的BG-顏色,但是當我只需點擊它只是它改變的部分。我假設這是因爲標籤尺寸不夠大。我該如何解決這個問題?
<label for="radio1">
<div class="panel-body">
<input type="radio" value="new" id="radio1" data-bind="checked: jobQuestionsFilter" class="" />
New Questions
(<span data-bind="text: newJobQuestionsCount"></span>)
</div>
</label>
然後在你的CSS應用display: none
您要的所有單選按鈕:
謝謝先生!有用。順便說一句,如果我點擊不同的盒子,如何才能使盒子的背景顏色發生變化,然後變回白色? – Dukakus17
@ user7677413請參閱我的答案上的編輯。 – Matthew
謝謝。你能看看我的編輯嗎? – Dukakus17