JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="test"></textarea>
<p>Placeholder text</p>
<textarea id="test2" placeholder="example"></textarea>
JavaScript
$(document).ready(function() {
//On init:
var initPlaceholderTxt = $("p").text();
//Execution:
//Using this, placeholder will not display correct information,
//lacking a previous clicked character:
$("#test").on("keydown", function( event ) {
var value = $( this ).val();
$("p").text(value);
$("#test2").attr("placeholder",value)
});
/*
//Core feature:
$("#test").keyup(function() {
var value = $( this ).val();
if(value != null && value != "") {
$("p").text(value);
}
else {
$("p").text(initPlaceholderTxt);
}
});
//Make characters appear more dynamically or faster:
$("#test").keydown(function() {
var value = $( this ).val();
$("p").text(value);
});
*/
});