Javascript examples for jQuery:Data Attribute
use a data-attribute as the href attribute value for an anchor
<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(){/*w w w.ja v a 2s . c o m*/ $("a:first").attr("href", $("div:first").data("q_id")); }); </script> </head> <body> <div data-q_id="#strategy" class="my wpb_row section my-fluid"></div> <a href="">lorem ipsum</a> </body> </html>