<a id = "test" data-url="https://www.google.com/"> <script> var a = document.getelementbyid('test'); var url = a.data('url'); </script>