So, i was reading the jquery documentation and i couldn't identify the differences between the functions jQuery.data()
and .data()
. What are the main difference between those functions?
Here is the link to documentation: Doc jquery
From the link you provided - it would appear it is simply just an older way of calling the same functionality in a more 'vanilla javascript' way...but it would appear there is one actual difference listed.
Note: This is a low-level method; a more convenient .data() is also available.
Regarding HTML5 data-* attributes: This low-level method does NOT retrieve the data-* attributes unless the more convenient .data() method has already retrieved them.
后者只是前者的一种更方便的语法: $.(domElement, 'key')
和$('selector').data('key')
做同样的事情。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.