I want to make a function that:
If the user selects the specific option in the select dropdown list, some text will be added to the textarea.
If the user selects other option in select, the textarea will be cleared.
I have tried this:
HTML
<select name="Problem" id="Problem">
<option value="option1">option1</option>
<option value="option2">option2</option>
<option value="option3">option3</option>
<option value="option4">option4</option>
</select>
<textarea name="csContent" id="csContent">
jQuery
$("#Problem").on("change", function () {
if ($('#Problem').val() == '3') {
$('#csContent').html('blahblahblah');
} else {
$('#csContent').val('');
}
});
However this doesn't work. Is there anything I missed?