jQuery <div> insert text from <textarea>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Insert Text Into Div from the Textarea</title> <style> .output{/*from w w w. j a v a2s. co m*/ padding: 10px; min-height: 50px; margin: 20px 0; background-color: #f1f1f1; border: 1px solid #e4e4e4; } </style> <script src="https://code.jquery.com/jquery-1.12.4.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..."> </textarea> </form> <div class="output"></div> </body> </html>