JSFiddle - React, Tailwind, and code Playground

by Ken Z

HTML

<p>
    <label for="method">How?</label>
    <select id="method" name="method" required>
        <option value="email">Email</option>
        <option value="web">Web</option>
    </select> <span class="help-text">The web, or email?</span>

</p>
<p>
    <label for="contact" id="contact">Email Address</label>
    <input type="email" name="contact" id="contact" value="" maxlength="255"> <span class="help-text">e.g. [email protected]</span>

</p>

CSS

body {
    font-size: 17px;
}
.help-text {
    display: block;
}
label, input {
    display: block;
}

JavaScript

$(document).ready(function () {
    $('#method').change(
    function () {
        var method = $('option:selected').val();
       
        if (this.value == "email") {
            $('#contact').text("Email Address");
        } else if (this.value == "web") {
            $('#contact').text("Web Address");
        }
    });

});