jQuery 学习笔记 Data Methods
.data()方法很简单就是和java中HashMap差不多的一种存储方式,具有键值对
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>data Demo</title> </head> <body> <div>123</div> <script type="text/javascript" src="jquery-1.10.2.min.js"></script> <script type="text/javascript"> $("div").data("div1",{foo:"bar"}); console.log($("div").data("div1")); </script> </body> </html>