val()
MethodYou 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">
<head>
<meta charset="utf-8">
<title>jQuery Set Textarea Value</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$(document).ready(function(){
var textContent = "The quick brown fox jumps over the lazy dog.";
$("button").click(function(){
$("#myTextarea").val(textContent);
});
});
</script>
</head>
<body>
<textarea id="myTextarea" rows="3" cols="50"></textarea>
<br>
<button type="button">Set Textarea Value</button>
</body>
</html>
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]
How to remove white space from the end of a string in PHP
Use the PHP rtrim() function...Use PHP Code into Laravel Blade
in this article, I will share with you h...How to check if variable is string in PHP
PHP is simple programming method by whic...How to Trigger a Click on a Link Using jQuery
Use the jQuery click() Method You can...How to Get Current Month Records in Laravel
You may want to add filter while fetchin...