JSFiddle - React, Tailwind, and code Playground
by Craig Haywood
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Auto Update Div with Content from Textarea</title>
<style>
.output{
padding: 10px;
min-height: 50px;
border: 1px solid #e4e4e4;
}
</style>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function(){
$("#myTextarea").keyup(function(){
// Getting the current value of textarea
var currentText = $(this).val();
// Setting the Div content
$(".output").text(currentText);
});
});
</script>
</head>
<body>
<form>
<textarea id="myTextarea" rows="5" cols="60" placeholder="Type something here...">rrrrrr</textarea>
</form>
<div class="output">fgdfdfg</div>
</body>
</html>