Skip to content
Related Articles
Open in App
Not now

Related Articles

How to find all textareas and makes a border using jQuery ?

Improve Article
Save Article
  • Last Updated : 31 Dec, 2020
Improve Article
Save Article

In this article, we will find all textareas and makes a border using jQuery. To add a border to the textarea element, we use css() method. The css() method is used to change style property of the selected element. The css() in jQuery can be used in different ways. The css() method can used to check the present value of the property for the selected element.

Syntax:

$(selector).css(property)

Return value: It will return the value of the property for the selected element.

Example:

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <!-- Import jQuery cdn library -->
    <script src=
    </script>
  
    <script>
        $(document).ready(function () {
            $("button").click(function () {
                $("textarea")
                    .css("border", "2px solid green");
            });
        });
    </script>
</head>
  
<body style="text-align: center;">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
  
    <h3>
        How to find all textareas and
        makes a border using jQuery?
    </h3>
  
    <textarea>HTML Textarea</textarea>
    <br><br>
  
    <textarea>CSS Textarea</textarea>
    <br><br>
  
    <textarea>JavaScript Textarea</textarea>
    <br><br>
  
    <button>Click Here!</button>
</body>
  
</html>

Output:

Before Button Click:

After Button Click:


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!