How to set the content of a textarea using jQuery?


On clicking the <a> tag,the content is dispaying inside the textarea.

Example

 Live Demo

<script type="text/javascript">
   $(document).ready(function () {
      $("a").click(function () {
         $("#txt1").val("I AM DISPLAYING IN THE TEXTAREA");
      });
   });
   </script>
<body>
<div>
<a id="quiresweb" class="webclass" href="#">Quires</a><br />
<label id="lbl">TEXTAREA ::</label>
<textarea id="txt1" rows="5" cols="20"></textarea><br />
</div>
</body>

Updated on: 21-Jun-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements