JSFiddle - React, Tailwind, and code Playground
by SullysRants
HTML
<select name="Invite" id="Invite" data-parsley-required>
<option value="" selected="selected">Select...</option>
<option value="Direct Mail Invitation">Direct Mail Invitation</option>
<option value="E-Mail Invitation">E-Mail Invitation</option>
<option value="From a Coworker">From a Coworker</option>
<option value="From a Friend">From a Friend</option>
<option value="Web Search">Web Search</option>
</select>
<div id="ShowMeInviteCoworker" style="display: none;">
<p>Coworkers Name:
<label id="browserlabel">
<input name="Other Browser" type="text" size="50" />
</label>
</p>
</div>
<div id="ShowMeInviteFriend" style="display: none;">
<p>Friends Name:
<label id="browserlabel">
<input name="Other Browser" type="text" size="50" />
</label>
</p>
</div>
JavaScript
$('select[name=Invite]').change(function (e) {
if ($('select[name=Invite]').val() == 'From a Coworker') {
$('#ShowMeInviteCoworker').show();
} else {
$('#ShowMeInviteCoworker').hide();
}
});
$('select[name=Invite]').change(function (e) {
if ($('select[name=Invite]').val() == 'From a Friend') {
$('#ShowMeInviteFriend').show();
} else {
$('#ShowMeInviteFriend').hide();
}
});