3
$( 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?

Paolo
  • 14,386
  • 26
  • 64
  • 85

1 Answers1

0

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>
PeterKA
  • 22,910
  • 4
  • 23
  • 48