How can I make the ddChild dropdown conditionally required and its selected value should not be the initial value(which is value="")

How can I make the ddChild dropdown conditionally required and its selected value should not be the initial value(which is value=“”), but only if the ddParent dropdown’s selected value is 3, using the jQuery Validation Plugin.

<form id="myForm">
    <select name="ddParent" id="ddParent">
        <option value="">Please select</option>
        <option value="1">Option 1</option>
        <option value="2">Option 2</option>
        <option value="3">Option 3</option>
    </select>
    <select name="ddChild" id="ddChild">
        <option value="">Please select</option>
        <option value="1">Option 1</option>
        <option value="2">Option 2</option>
        <option value="3">Option 3</option>
    </select>    
</form>

I have using this plugin
https://jqueryvalidation.org/----https://cdn.jsdelivr.net/npm/jquery-validation@1.19.5/dist/jquery.validate.min.js

The documentation on that plugin is… not overly helpful, but it looks like you’d need to define a rule with a depends condition.

1 Like