With the help of data() function you only able to get data to attribute values. Attributes are the basic components of the html elements helps to manipulate in jQuery. Use the ui-btn attribute inst jQuery itself uses the .data() method to save information under the names 'events' and 'handle', and also reserves any data name starting with an underscore ('_') for internal use. Definition and Usage. The jQuery Mobile framework uses HTML5 data-attributes to allow for markup-based initialization and configuration of widgets. As of jQuery 1.5, withDataAndEvents can be optionally enhanced with deepWithDataAndEvents to copy the events and data for all children of the cloned element. How to use jQuery hasAttribute() method to see if there is an attribute on an element? I data-* attributes ci permettono di memorizzare informazioni extra su elementi semantici HTML standard senza utilizzare altri hack quali l'utilizzo di attributi non standard, proprietà extra nel DOM o Node.setUserData(). you can set input values after the fact, and do a few other good tricks in the process. Using jQuery's .attr() method to get the value of an element's attribute has two main benefits:. Note: Although it is possible to add the style attribute with a value to an element with this method, it is recommended that you use properties of the Style object instead for inline styling, because this will not overwrite other CSS properties that may be specified in the style attribute: In this jquery tutorial, you will learn two ways to get data-id, data-attribute, data-text etc. jQuery - Attributes - Some of the most ... Set the value attribute of every matched element if it is called on but if it is called on