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:




Example of jQuery prop() method 


 <!DOCTYPE html>
<html xmlns="">
    <title>Jquery Tutorials</title>
    <script src="Scripts/jquery-1.8.2.min.js"></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>




When you click on button then your checkbox will be checked and alse textbox value show inside “txtvalue” div like shown as below :


I hope it will help to you.


Leave a comment

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

Welcome to SQL Tutorials Point

Don't have an account? Click here to Create a new account, it takes less than a minute.