jQuery.data()和.data()之间的区别?
问题描述:
因此,我正在阅读 jquery 文档,但无法识别功能jQuery.data()
和.data()
之间的区别.这些功能之间的主要区别是什么?
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?
以下是文档的链接: Doc jquery
答
对于前者而言,后者只是一种更方便的语法:$.(domElement, 'key')
和$('selector').data('key')
做同样的事情.
The latter is just a more convenient syntax for the former: $.(domElement, 'key')
and $('selector').data('key')
do the same thing.