Javascript examples for jQuery:Data Attribute
JQuery loop through HTML5 Data Attributes
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> <script type="text/javascript"> $(window).load(function(){/*from www . j av a2 s . c o m*/ $.each($('a').data(), function(i, v) { console.log('"' + i + '":"' + v + '",'); }); }); </script> </head> <body> <a data-type="file" data-path="/some/path" data-size="123">Link</a> </body> </html>