How can I show a second drop down based on the value of the first dropdown option selected? There's several options in the first dropdown, I want to use the value of that to tie it to the second drop downs class.
The value in the first dropdown options is the same as the var-<?php echo $product_id; ?> class, there's several dropdowns like the second one
<select class="prod-select" name="product_cat">
<?php while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
<option value="<?php echo get_the_id(); ?>"><?php echo get_the_title(); ?></option>
<?php endwhile; ?>
</select>
<select class="var-<?php echo $product_id; ?>" name="product_var">
<option value="4_week"><?php echo $variationName; ?></option>
</select>
This is my jquery, I'm not sure how to have a dynamic class name.
$('.prod-select').on('change', function() {
$('.var-select').hide();
$(this.value).toggle();
});