0

I am using the wp_dropdown_categories to generate the form and select option, with multiple select jquery plugin.

What I want is that, when the user selects the Parent category or (level-1) then the child categories (level-2 or level-3) should be auto selected. Since there is no grouping, can this be done by Jquery?

Following is the html code.

<optgroup  label="Categories">
<option class="level-1" value="519">Parent 1</option>
    <option class="level-2" value="521">Parent 1 child 1</option>
    <option class="level-2" value="522">Parent 1 Child 2</option>
        <option class="level-3" value="523">1st Sub Child of 2</option>
        <option class="level-3" value="524">2nd Sub Child of 2</option>
<option class="level-1" value="519">Parent 2</option>
        <option class="level-2" value="525">Parent 2 Child 1</option>
        <option class="level-2" value="526">Parent 2 Child 2</option>
        <option class="level-2" value="527">Parent 2 Child 3</option>
</optgroup>
  • Is this a multiple select? – gmazzap Jul 29 '13 at 12:06
  • Yes, this is a multi-select – Naveen Narale Jul 29 '13 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.