Here is the jsFiddle if you want to play with the code!. If you put a breakpoint on the statement that changes the data attribute and then look at the DOM Explorer, you can see that the data property has not been set to the PDF, and then if you step over that statement and look at the DOM again, you can see that the property has been updated. I have my file loaded at the end as you've suggested. The attr() method sets or returns attributes and values of the selected elements. jQuery support for the new HTML5 data attributes may not be everything a developer could want -- but it's very close. This is very easy to overlook. jQuery attr() Method. Using the jQuery data attr() method, you can get and set data attribute values easily from selected html elements. The jQuery attr() method is used to get or set attributes and values of the selected html elements. And, more important, it's the perfect solution for handling transactional data. jQuery not working, however it is loading perfectly!!! As I can not make any assumptions about the data I have to transport, I encode64 it before enclosing it as a value in ‘ ‘ or ” ” for the data-attribute. JSON data (or any other data) inside data attributes …. HTML data attributes are case-insensitive, so any options which contain capital letters will … Also here are a couple of good articles about this issue – Working with the HTML5 Data Attributes Using jQuery. Regarding why you might not use jQuery to set attributes: many client side templating languages build DOM, including data attributes. Definition and Usage. The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery). version added: 1.0 jQuery( "[attribute!='value']" ) attribute: An attribute name. How to get and set data attribute values. If that zoom plugin of yours is using jQuery.data() to handle attached data, it won't see the changes you make to the data attributes.jQuery.data() reads the data attributes from the DOM on first access, and on first access only.After that, the attributes are cached. When this method is used to set attribute values, it sets one or more attribute/value pairs for the set of matched elements. For get an attribute’s value use the below syntax Make sure that it is the first script loaded on your page. value: An attribute value.Can be either a valid identifier or a quoted string. Due to a jQuery bug, nested options using data-* attributes do not work in jQuery 1.x. When this method is used to return the attribute value, it returns the value of the FIRST matched element.. However, when using the HTML notation, nothing happens. By Peter Vogel; 02/03/2013 That doesn't work for me. The problem exists because browsers understand javascript and not stand alone jQuery snippets. I'm unable to set a mask on any kind of element. The value of the option is subject to jQuery's parsing rules for HTML5 data attributes. Syntax. Description: Select elements that either don't have the specified attribute, or do have the specified attribute but not with a certain value. jQuery turns our code into normal javascript code, so that the browsers can interpret what we are saying. camelCase options. I use the data-attribute to transport data from a backend SQL-DB via PHP to my web clients. I believe what you confirmed in this thread is that the HTML notation should work without any JS; just importing the 'jquery.mask.min' file is enough. Now, no matter if you remove the button and add it again, the click event will always work because it is delegated from the button’s parent or parent’s parent.In this case, that is the body element tag which has not been removed and still loaded in the DOM.. jQuery Forum Move this topic Forum : Getting Started Using jQuery Using jQuery Plugins Using jQuery UI Developing jQuery Core Developing jQuery Plugins Developing jQuery UI QUnit and Testing About the jQuery Forum jQuery Conferences jQuery Mobile Developing jQuery Mobile