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
  • 15,233
  • 27
  • 70
  • 91

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
  • 24,158
  • 5
  • 26
  • 48