Wednesday, 27 April 2022

Get Attributes - attr()

 <!DOCTYPE html>

<html>

<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<script>

$(document).ready(function(){

  $("button").click(function(){

    alert($("#w3s").attr("href"));

  });

});

</script>

</head>

<body>


<p><a href="https://www.ommaurya.com" id="w3s">ommaurya.com</a></p>


<button>Show href Value</button>


</body>

</html>

No comments:

Post a Comment