How to set the content of a textarea using jQuery?

In this post, we will show you set the content of a textarea using jQuery.

1. Code:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
      $("a").click(function () {
         $("#txt1").val("I AM DISPLAYING IN THE TEXTAREA");
      });
   });
</script>
</head>
<body>
<div>
<a href="#">Click Here</a><br />
<label>TEXTAREA ::</label>
<textarea id="txt1" rows="5" cols="20"></textarea><br />
</div>
</body>
</html>

2. Example:

Run the program to get the result.

https://jsfiddle.net/soltuts/3rbze2x1/