Syncing Dropdown values with Dependencies

[ad_1]

Hello,

I have two dropdown selectors, both with the same series of values (50, 100, 500, 1000). I have created a script so that when you change the value of one dropdown, the other changes as well to match. This is all working fine.

The problem is…each dropdown value also has a dependency, so when a value is selected, a separate field appears. But this dependency does not trigger when using this script.

Here is what I have so far:

— #dropdownA —
50 (show field 1)
100 (show field 2)
500 (show field 3)
1000 (show field 4)

-- #dropdownB --
50 (show field 5)
100 (show field 6)
500 (show field 7)
1000

(show field 8)

My script:

jQuery(document).ready(function($) {
var $selects=$('#dropdownA,#dropdownB').change(function(){
    $selects.not(this).val( $(this).val() );
})

Any help with getting the dependencies to work with this script would be greatly appreciated!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer