JSFiddle - React, Tailwind, and code Playground

HTML

<select id="questionYesNo" >
    <option value="1">Yes</option>
    <option value="0">No</option>
</select>


<select id="questionAB" >
    <option value="65">A</option>
    <option value="66">B</option>
</select>

<br/>

<input id="child1" type="text" value="First"></input>
<input id="child2" type="number" value="2"></input>

JavaScript

var dependentFields = [
    { parent: 'questionYesNo', children: ['child1'], choiceTrigger: 'No', markAsReq: true },
    { parent: 'questionAB', children: ['child2'], choiceTrigger: 'B', markAsReq: true }
];

function attachEventHandlers() {
    // begin dependent fields
    for (var i = 0; i < dependentFields.length; i++) {
        var o = dependentFields[i];
        $('#' + o.parent).change(function () {
            var visible = $('#' + o.parent + ' :selected').text() === o.choiceTrigger;
            for (var c = 0; c < o.children.length; c++) {
                var child = o.children[c];
                if (visible) {
                    $('#' + child).show();   
                } else {
                    $('#' + child).hide();
                }
            }
        });
    }
}

attachEventHandlers();