[Solved] if selected abc in select element how happen abc group items in second select element [closed]


Something like this using jQuery?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<select id = 'first'>
    <option disabled selected>--select</option>
    <option>ABC</option>
    <option>123</option>
</select>
<select id = 'second' style="display:none">
</select>
<script>
    var optionsAbc="<option>A</option><option>B</option>";
    var options123 = '<option>1</option><option>2</option>';
    $("#first").change(function() {
        $("#second").show();
        var value = $(this).val();
        if(value == 'ABC') {
            $("#second").html(optionsAbc);
        } else if (value == '123') {
            $("#second").html(options123);
        }
    });
</script>

0

solved if selected abc in select element how happen abc group items in second select element [closed]