Many thanks for your replies.
I have tried this with some success:
<select name="test1" id="test1">
<option value="Select">Select</option>
<option value="a">a</option>
<option value="b">b</option>
</select>
<select id="test2" name="test2">
<option value="Select">Select</option>
<option class="a" value="a">a</option>
<option class="a" value="b">b</option>
<option class="a" value="c">c</option>
<option class="b" value="1">1</option>
<option class="b" value="2">2</option>
<option class="b" value="3">3</option>
</select>
select option[disabled] {
display: none;
}
jQuery(document).ready(function($){
$(’#test1’).on(‘change’, function(e){
var className = e.target.value;
$(’#test2 option’).prop(‘disabled’, true);
$(’#test2’).find(‘option.’ + className).prop(‘disabled’, false);
});
});
[code]
Ultimately, I’m trying to learn/add a second dropdown to an existing web script’s inital dropdown. Which shows this in the Form:
<div class="form-group">
<label class="col-md-12" for="category_id">{{LANG category}}</label>
<div class="col-md-12">
<select name="category_id" id="category_id" class="form-control">
<?php foreach($pt->categories as $key => $category) {?>
<option value="<?php echo $key?>"><?php echo $category?></option>
<?php } ?>
</select>
</div>
</div>
So, to begin, I’m trying to add an option of the secondary dropdown. So maybe something like:
<select name="category_id" id="category_id" class="form-control">
<?php foreach($pt->categories as $key => $category) {?>
<option value="<?php echo $key?>"><?php echo $category?></option>
<option value="<?php echo $key?>"><?php echo $category2?></option>
</select>
<div class="form-group">
<label class="col-md-12" for="category_id">{{LANG category2}}</label>
<div class="col-md-12">
<select id="category2" name="category2">
<option value="<?php echo $key?>"><?php echo $category2?></option>
<option value="<?php echo $key?>"><?php echo $category2?></option>
<option value="<?php echo $key?>"><?php echo $category2?></option>
<?php } ?>
I look forward to being further enlightened. Much thanks again.