我想弄清楚哪些複選框被選中,所以我嘗試這種代碼:獲取所有的列表選中的複選框
$('.feature input[type="checkbox"').serialize();
這是我的HTML看起來像:
<div class="feature">
<h2>Features</h2>
<label><input class="custom_css" checked="" type="checkbox" name="feature[]"> Custom CSS (style.css)</label>
<label><input class="custom_js" checked="" type="checkbox" name="feature[]"> Custom Javascript (script.js)</label>
<label><input class="modernizr" type="checkbox" name="feature[]"> Modernizr</label>
<label><input class="google_maps" type="checkbox" name="feature[]"> Google Maps</label>
<label><input class="custom_api" type="checkbox" name="feature[]"> Custom API</label>
<label><input class="font_awesome" type="checkbox" name="feature[]"> Font Awesome</label>
</div>
而且這是我得到的輸出:
陣列(1){[ 「var_sent_via_ajax」] =>串(67) 「特徵%5B%5D =上&功能%5B%5D =上&功能%5B%5D =上&功能%5B%5D =的」 }
現在,我怎麼知道他們已經檢查?那麼標誌是什麼意思?
相關? [使用jQuery獲取選中的複選框列表](http://stackoverflow.com/q/2155622/1983854) – fedorqui
您可以使用':checked'即'$('。feature input:checked')' – Satpal