You know when you type text into a form input and it automatically types the same text in another div? Well I am trying to do the same thing but instead show the same text value from the div 1 to div 2.
Here is my code. It works with the input text field but not with the textarea. Can you tell me why?
<input type="text" name="title" id="title" value="" maxlength="55" />
<textarea name="details" id="details" value="" maxlength="160" ></textarea>
<!-- Values show up in these inputs -->
<input type="text" name="seo_page_title" id="seo_page_title" value="" maxlength="55" />
<textarea name="seo_page_description" id="seo_page_description" maxlength="160" ></textarea>
<script>
$('#title').on("input", function() {
var dInput = this.value;
console.log(dInput);
$('#seo_page_title').val(dInput);
});
$('#details').on("input", function() {
var dInput = this.value;
console.log(dInput);
$('#seo_page_description').val(dInput);
});
</script>