Get the URL address of the link. - Javascript jQuery

Javascript examples for jQuery:Link

Description

Get the URL address of the link.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    console.log($("a").attr("href"));
});/*w  ww.  jav a 2s. c o  m*/
</script>
</head>
<body>

<a href="http://java2s.com/">W3Schools</a>

</body>
</html>

Related Tutorials