$( document ).data( 'foo', 'bar' );
Is there a DOM element that gets a data
attribute
data-foo="bar"`
Or is the value bar
stored internally by jQuery?
$( document ).data( 'foo', 'bar' );
Is there a DOM element that gets a data
attribute
data-foo="bar"`
Or is the value bar
stored internally by jQuery?
This demo may shed some light. Please view the console output.
$(document).data({'test1':'just a string','test2': [1,3,76,45],'test3':1000});
console.log( $(document).data() )
console.log( $(document)[0] );
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>