<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>ajax file</title> <script src="./js/jquery-1.12.4.min.js"></script> <script> $(function(){ // 获取data-a的属性值 data("-后面的字符") alert($(".box").data("a")) }); </script> </head> <body> <div class="box" data-a="嘿嘿"> 嘿嘿 </div> </body> </html>
原文地址:https://www.cnblogs.com/lowmanisbusy/p/9048836.html
时间: 2024-10-25 14:07:34