How to Set Value of Textarea in jQuery

  16296 views   2 years ago jQuery

Use the jQuery val() Method

You can simply use the val() method to set the value of a textarea dynamically using jQuery.

Let's try out the following example to understand how it basically works:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>jQuery Set Textarea Value</title>
<script src=""></script>
        var textContent = "The quick brown fox jumps over the lazy dog.";
    <textarea id="myTextarea" rows="3" cols="50"></textarea>
    <button type="button">Set Textarea Value</button>


Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]