In this article we will explain how to use prop() in jQuery or why use prop() in jQuery or how to set get  property value of selected html element using jquery with example.


The jQuery prop() method is used to get or set value of selected html elements i.e. DOM properties (like tagName, nodeName, defaultChecked) or own custom made properties. This is a very convenient way to set the values of properties, especially the multiple properties.


To get the value of a property:


To set the property and value:


Let’s see, Example of jQuery prop() method:

<!DOCTYPE html>
<html xmlns="">
    <title>Example of jQuery prop method</title>
    <script type="text/javascript" src=""></script>
        $(document).ready(function () {
            $("button").click(function () {
                $('#Checkbox1').prop("checked", true)
    <input id="Checkbox1" type="checkbox" /><br />
    <input id="Text1" type="text" value="Aditya" /><br /><br />
    <button>Click here to get and set value</button><br />
    <br />
    <div id="txtvalue"></div>

 Let's check live example

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like