我需要一个小型的jQuery脚本,它将根据选择的值来检查相应的复选框。
例如:如果在。对于选择列表中的所有选项都是如此:
- “P.J. Gallagher's Drummoyne”选中。
- “P.J. Gallagher's Parramatta”选中。
- “Union Hotel North Sydney”选中。
有人实现过类似的功能吗?以下为HTML代码示例:
<div class="item">
<label for="CAT_Custom_70944">Preferred GMH Hotel <span class="req">*</span></label><br />
<select name="CAT_Custom_70944" id="CAT_Custom_70944" class="cat_dropdown">
<option value=" " selected="selected">- Please Select -</option>
<option value="P.J. Gallagher's Drummoyne">P.J. Gallagher's Drummoyne</option>
<option value="P.J. Gallagher's Parramatta">P.J. Gallagher's Parramatta</option>
<option value="Union Hotel North Sydney">Union Hotel North Sydney</option>
</select>
</div>
<div class="item">
<input type="checkbox" id="drummoyne-list" class="checkbox" name="CampaignList_20320" /> <label>Subscribe to: P.J. Gallagher's Drummoyne Newsletter</label>
</div>
<div class="item">
<input type="checkbox" id="parramatta-list" class="checkbox" name="CampaignList_20321" /> <label>Subscribe to: P.J. Gallagher's Parramatta Newsletter</label>
</div>
<div class="item">
<input type="checkbox" id="union-list" class="checkbox" name="CampaignList_20322" /> <label>Subscribe to: The Union Hotel Newsletter</label>
</div>