What is the difference between . data() and Jquery.data()?

Asked

Viewed 197 times

3

I was reading the jquery documentation and did not understand very well what the main difference between two already that both serve to store data from an html tag.

  • 1

    Good question, +1.. but I believe the most used is . data()

1 answer

2


The only difference between .date() and Jquery.data() is that Jquery.data is a method of low level, compared to .date().

Comparing the code between the two, .date() is much more usual.

See the difference:

$("div").data("test");

var div = $("div")[0];    
jQuery.data(div,"test");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.