jQuery prop() Method Last Updated : 13 Jul, 2023 Suggest changes Share Like Article Like Report The prop() is an inbuilt method in jQuery that is used to set or return properties and values for the selected elements. When this method is used to return the property value, it returns the value of the FIRST matched element and when this method is used to set property values, it sets one or more properties for the selected elements. Syntax : $(selector).prop(para1, para2)Parameters: It accepts two parameters which are specified below- para1: It specifies the property.para2: It specifies the value of the property in case of set. Return Value:It returns the property and value set for the property for the selected element. jQuery code to show the working of prop() method: html <!DOCTYPE html> <html> <head> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <!-- jQuery code to show the working of this method --> <script> $(document).ready(function () { $("button").click(function () { var $x = $("p"); $x.prop("color", "green"); $x.append(" Property is color and its value: " + $x.prop("color")); }); }); </script> <style> div { width: 250px; padding: 10px; height: 100px; border: 2px solid green; } </style> </head> <body> <div> <p></p> <br><br> <!-- click on button this method --> <button>Click Here!</button> </div> </body> </html> Output: K kundankumarjha Follow Article Tags : JQuery jQuery-HTML/CSS Explore jQuery Tutorial 8 min read Getting Started with jQuery 4 min read jQuery Introduction 7 min read jQuery Syntax 2 min read jQuery CDN 4 min read jQuery SelectorsJQuery Selectors 5 min read jQuery * Selector 1 min read jQuery #id Selector 1 min read jQuery .class Selector 1 min read jQuery EventsjQuery Events 4 min read jQuery bind() Method 2 min read jQuery blur() Method 1 min read jQuery change() Method 2 min read jQuery EffectsjQuery animate() Method 2 min read jQuery clearQueue() Method 2 min read jQuery delay() Method 2 min read jQuery HTML/CSSjQuery addClass() Method 2 min read jQuery after() Method 1 min read jQuery append() Method 2 min read jQuery TraversingjQuery | Traversing 4 min read jQuery add() method 1 min read jQuery addBack() Method 2 min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like