I have 3 drop down lists, all get there values from an array. I would like to change the selection of the second and third drop down lists when the first box has changed.
i.e.
<select id="first_box">
<option> options 1</option>
<option> options 2</option>
<option> options 3</option>
</select>
<select id="second_box">
<option> options 1</option>
<option> options 2</option>
<option> options 3</option>
</select>
<select id="third_box">
<option> options 1</option>
<option> options 2</option>
<option> options 3</option>
</select>
If you select option 3 in the first box, then change the second and third boxes to option 3
Here's the code I have so far
jQuery(document).ready(function($){
$('#font-name').change(function($){
alert('first box has been changed');
});
});
UPDATE:
Sorry I should of mentioned that the 2nd and 3rd values would be different, I just used the option 1,2, 3 as an example. SORRY.
Here's my actual selection box code
<select id="font-name" name="layout_options[h1_font_name]">
<?php foreach( $fonts as $key => $font ): ?>
<option <?php if($key == $current) echo "SELECTED"; ?> value="<?php echo $key; ?>"><?php echo $font['name']; ?></option>
<?php endforeach; ?>
</select>
<select id="font-font" name="layout_options[h1_font_font]">
<?php foreach( $fonts as $key => $font ): ?>
<option <?php if($key == $current) echo "SELECTED"; ?> value="<?php echo $font['font']; ?>"><?php echo $font['font']; ?></option>
<?php endforeach; ?>
</select>
<select id="font-css" name="layout_options[h1_font_css]">
<?php foreach( $fonts as $key => $font ): ?>
<option <?php if($key == $current) echo "SELECTED"; ?> value="<?php echo $font['css']; ?>"><?php echo $font['css']; ?></option>
<?php endforeach; ?>
</select>