how to get textarea value in jquery?

Today, We want to share with you how to get textarea value in jquery?.In this post we will show you how to set textareas value in jquery, hear for get all textareas value in jquery we will give you demo and example for implement.In this post, we will learn about jquery get textareas value with an example.

How to get the value of a textarea in jQuery?

Example 1: index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Get Value from Textarea in jQuery - www.pakainfo.com</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
    $(document).ready(function(){
        $("button").click(function(){
            var comment = $.trim($("#comment").val());
            if(comment != ""){
                // Show alert dialog if value is not blank
                alert(comment);
            }
        });
        
    });
</script>
</head>
<body>
    <textarea id="comment" rows="5" cols="50"></textarea>
    <p><button type="button">Get Value</button></p>
    <p><strong>Note:</strong> Type something in the textareas and click the button to see the output.</p>
</body>
</html>

I hope you get an idea about jquery textareas value empty.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.