First of all I want to say that I have searched for possible solutions and have found similar questions. But the problem is that I have no control over HTML part.
List is generated by wp_types plugin dynamicly, so, I cannot add custom classes to HTML in order to change particular value with JS.
Here is my code:
<ul class="wpt-form-set wpt-form-set-checkboxes wpt-form-set-checkboxes-event-type" data-level="0"><li class="tax-corporate-events tax-event-type-52">
<input type="checkbox" id="cred_form_6568_1-checkbox-30-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-30-1438779193" data-wpt-name="event-type[]" value="52" data-parent="-1" data-value="CORPORATE EVENTS" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-30-1438779193">CORPORATE EVENTS</label>
</li>
<li class="tax-children-of-52"><ul class="wpt-form-set-children wpt-form-set-children-level-1" data-level="1"><li class="tax-after-dinner-shows tax-event-type-87">
<input type="checkbox" id="cred_form_6568_1-checkbox-31-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-31-1438779193" data-wpt-name="event-type[]" value="87" data-parent="52" data-value="AFTER DINNER SHOWS" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-31-1438779193">AFTER DINNER SHOWS</label>
</li>
<li class="tax-award-ceremonies tax-event-type-92">
<input type="checkbox" id="cred_form_6568_1-checkbox-32-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-32-1438779193" data-wpt-name="event-type[]" value="92" data-parent="52" data-value="AWARD CEREMONIES" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-32-1438779193">AWARD CEREMONIES</label>
</li>
<li class="tax-background-music tax-event-type-86">
<input type="checkbox" id="cred_form_6568_1-checkbox-33-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-33-1438779193" data-wpt-name="event-type[]" value="86" data-parent="52" data-value="BACKGROUND MUSIC" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-33-1438779193">BACKGROUND MUSIC</label>
</li>
<li class="tax-comperes tax-event-type-91">
<input type="checkbox" id="cred_form_6568_1-checkbox-34-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-34-1438779193" data-wpt-name="event-type[]" value="91" data-parent="52" data-value="COMPERES" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-34-1438779193">COMPERES</label>
</li>
<li class="tax-dance-the-night-away tax-event-type-89">
<input type="checkbox" id="cred_form_6568_1-checkbox-35-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-35-1438779193" data-wpt-name="event-type[]" value="89" data-parent="52" data-value="DANCE THE NIGHT AWAY" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-35-1438779193">DANCE THE NIGHT AWAY</label>
</li>
<li class="tax-exhibitions tax-event-type-84">
<input type="checkbox" id="cred_form_6568_1-checkbox-36-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-36-1438779193" data-wpt-name="event-type[]" value="84" data-parent="52" data-value="EXHIBITIONS" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-36-1438779193">EXHIBITIONS</label>
</li>
<li class="tax-mix-mingle tax-event-type-90">
<input type="checkbox" id="cred_form_6568_1-checkbox-37-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-37-1438779193" data-wpt-name="event-type[]" value="90" data-parent="52" data-value="MIX & MINGLE" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-37-1438779193">MIX & MINGLE</label>
</li>
<li class="tax-product-launches tax-event-type-85">
<input type="checkbox" id="cred_form_6568_1-checkbox-38-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-38-1438779193" data-wpt-name="event-type[]" value="85" data-parent="52" data-value="PRODUCT LAUNCHES" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-38-1438779193">PRODUCT LAUNCHES</label>
</li>
<li class="tax-wow-factor tax-event-type-88">
<input type="checkbox" id="cred_form_6568_1-checkbox-39-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-39-1438779193" data-wpt-name="event-type[]" value="88" data-parent="52" data-value="WOW FACTOR" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-39-1438779193">WOW FACTOR</label>
</li></ul></li>
<li class="tax-private-parties tax-event-type-83">
<input type="checkbox" id="cred_form_6568_1-checkbox-40-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-40-1438779193" data-wpt-name="event-type[]" value="83" data-parent="-1" data-value="PRIVATE PARTIES" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-40-1438779193">PRIVATE PARTIES</label>
</li>
<li class="tax-children-of-83"><ul class="wpt-form-set-children wpt-form-set-children-level-1" data-level="1"><li class="tax-chill-out tax-event-type-101">
<input type="checkbox" id="cred_form_6568_1-checkbox-41-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-41-1438779193" data-wpt-name="event-type[]" value="101" data-parent="83" data-value="CHILL OUT" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-41-1438779193">CHILL OUT</label>
</li>
<li class="tax-party-band tax-event-type-99">
<input type="checkbox" id="cred_form_6568_1-checkbox-42-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-42-1438779193" data-wpt-name="event-type[]" value="99" data-parent="83" data-value="PARTY BAND" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-42-1438779193">PARTY BAND</label>
</li>
<li class="tax-tribute-theme tax-event-type-98">
<input type="checkbox" id="cred_form_6568_1-checkbox-43-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-43-1438779193" data-wpt-name="event-type[]" value="98" data-parent="83" data-value="TRIBUTE THEME" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-43-1438779193">TRIBUTE THEME</label>
</li>
<li class="tax-walk-around-acts tax-event-type-102">
<input type="checkbox" id="cred_form_6568_1-checkbox-44-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-44-1438779193" data-wpt-name="event-type[]" value="102" data-parent="83" data-value="WALK AROUND ACTS" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-44-1438779193">WALK AROUND ACTS</label>
</li>
<li class="tax-wow-factor tax-event-type-100">
<input type="checkbox" id="cred_form_6568_1-checkbox-45-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-45-1438779193" data-wpt-name="event-type[]" value="100" data-parent="83" data-value="WOW FACTOR" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-45-1438779193">WOW FACTOR</label>
</li></ul></li>
<li class="tax-wedding tax-event-type-53">
<input type="checkbox" id="cred_form_6568_1-checkbox-46-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-46-1438779193" data-wpt-name="event-type[]" value="53" data-parent="-1" data-value="WEDDING" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-46-1438779193">WEDDING</label>
</li>
<li class="tax-children-of-53"><ul class="wpt-form-set-children wpt-form-set-children-level-1" data-level="1"><li class="tax-ceremony tax-event-type-93">
<input type="checkbox" id="cred_form_6568_1-checkbox-47-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-47-1438779193" data-wpt-name="event-type[]" value="93" data-parent="53" data-value="CEREMONY" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-47-1438779193">CEREMONY</label>
</li>
<li class="tax-drinks-reception tax-event-type-94">
<input type="checkbox" id="cred_form_6568_1-checkbox-48-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-48-1438779193" data-wpt-name="event-type[]" value="94" data-parent="53" data-value="DRINKS RECEPTION" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-48-1438779193">DRINKS RECEPTION</label>
</li>
<li class="tax-evening-party tax-event-type-95">
<input type="checkbox" id="cred_form_6568_1-checkbox-49-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-49-1438779193" data-wpt-name="event-type[]" value="95" data-parent="53" data-value="EVENING PARTY" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-49-1438779193">EVENING PARTY</label>
</li>
<li class="tax-mix-mingle tax-event-type-97">
<input type="checkbox" id="cred_form_6568_1-checkbox-50-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-50-1438779193" data-wpt-name="event-type[]" value="97" data-parent="53" data-value="MIX & MINGLE" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-50-1438779193">MIX & MINGLE</label>
</li>
<li class="tax-sangeet tax-event-type-96">
<input type="checkbox" id="cred_form_6568_1-checkbox-51-1438779193" name="event-type[]" data-wpt-type="checkbox" data-wpt-id="cred_form_6568_1_cred_form_6568_1-checkbox-51-1438779193" data-wpt-name="event-type[]" value="96" data-parent="53" data-value="SANGEET" class="wpt-form-checkbox form-checkbox checkbox"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_6568_1-checkbox-51-1438779193">SANGEET</label>
</li></ul></li></ul>
I need parent checkbox to be selected when any of child checkboxes is selected.
And is there any way to make it work even if there will be more event types added by wordpress?
Thank you in advance!
Aucun commentaire:
Enregistrer un commentaire