JSFiddle - React, Tailwind, and code Playground
by MrTest
JavaScript
$('select[name="q2"]').change(Q2Change).keypress(Q2Change);
var Q2Change = function() {
if ($(this).children("option:selected").val() === "yes") {
// Show Injury Form = Hide All Near Miss
$('.nearmiss').each(function() {
$(this).hide();
});
$('.injury').each(function() {
$(this).show();
});
} else if ($(this).children("option:selected").val() === "no") {
// Show Near Miss Form = Hide All Injury
$('.injury').each(function() {
$(this).hide();
});
$('.nearmiss').each(function() {
$(this).show();
});
}
}