私はjQueryを使用して複数のチェックボックスの値を取得し、コンマ区切りの文字列として出力します。
<li><input type="checkbox" name="areaofinterest" value="home_coo" id="home_coo" class="Checkbox" > Cooking</li>
<li><input type="checkbox" name="areaofinterest" value="home_cra" id="home_cra" class="Checkbox"> Crafts</li>
<li><input type="checkbox" name="areaofinterest" value="home_dec" id="home_dec" class="Checkbox"> Decorating</li>
<li><input type="checkbox" name="areaofinterest" value="home_ent" id="home_ent" class="Checkbox"> Entertaining</li>
<li><input type="checkbox" name="areaofinterest" value="home_gar" id="home_gar" class="Checkbox"> Gardening</li>
<li><input type="checkbox" name="areaofinterest" value="home_hom" id="home_hom" class="Checkbox"> Home Improvement</li>
<li><input type="checkbox" name="areaofinterest" value="home_mar" id="home_mar" class="Checkbox"> Marriage</li>
<li><input type="checkbox" name="areaofinterest" value="home_par" id="home_par" class="Checkbox"> Parenting</li>
<li><input type="checkbox" name="areaofinterest" value="home_pet" id="home_pet" class="Checkbox" > Pets</li>
<li><input type="checkbox" name="areaofinterest" value="home_ret" id="home_ret" class="Checkbox"> Retirement</li>
は、どのように私はjQueryのareaofinterest = "home_coo、home_mar、home_pet" としてチェック値と出力を取得するために使用することができ、以下のように多くのcheckboxsがありますか?
ありがとうございます。
うわー...驚くべきことに...ありがとうございました... – Frank
ちょうどFYI - joinの中の "、"は必要ありません。なぜなら、 'join()'を使うときにデフォルトでコンマを追加するからです。注意すべき点は、jQueryが '.map()'のドキュメントで使用する正確なシナリオです:http://api.jquery.com/map/ – Roi
[更新されたデモ](http://jsfiddle.net/ Nr2zU/683 /):コンマ区切り文字列を作成し、文字列を格納してから、文字列を使用してチェックボックスを復元します。 – Patrick