How to use Misc Data() Method in JQuery

In this article I am going to explain about Misc data() method in jquery.
  • 2352

jQuery Misc Data() Method

jquery Misc Data() method use for get the data from an element or set the data to an element.

Syntax for set the data to an element


Syntax for get the data from an element.



Example // Its example will display two button first button for set  the data to an element and second for get data from element.




    <script type="text/javascript" src="jquery.js"></script>

    <script type="text/javascript">

        $(document).ready(function () {

            $("#bt1").click(function () {

                $("p").data("prabh", "Hello Friends");


            $("#bt2").click(function () {







    <button id="bt1">

        Get</button><br />

    <button id="bt2">











You may also want to read these related articles: here
Ask Your Question 
Got a programming related question? You may want to post your question here
© 2020 DotNetHeaven. All rights reserved.