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 id="help-change" class="help-text">e.g. stuff@yourdomain.com</span>
JavaScript
$(document).ready(
$('#method').bind('change',
function(){
var method = $('option:selected',this).text();
alert(method);
if (method == "Email") {
$('#contact-label').text("Email Address");
$('#help-change').text("Email Address");
$('#contact').attr('type','email');
} else if (method == "Web") {
$('#contact-label').text("App URL");
$('#help-change').text("Web Address");
$('#contact').attr('type','url');
}
}
)
);