JSFiddle - React, Tailwind, and code Playground
HTML
<label for="method">How?</label>
<select id="method" name="method" required>
<option name="method" value="email">Email</option>
<option name="method" value="web">Web</option>
</select>
<span class="help-text">The web, or email?</span>
</label>
<label id="contact-label" for="contact">Email Address</label>
<input type="email" name="contact" id="contact" value="" maxlength="255">
<span class="help-text">e.g. stuff@yourdomain.com</span>
JavaScript
$(document).ready(
function() {
$('#method').change(
function(){
var method = $('option:selected',this).text();
if method == "Email" {
$('#contact-label').text("Email Address");
} else if method == "Web" {
$('#contact-label').text("App URL");
}
}
);
}
);