How to use attr() method in jQuery to get the value of an attribute?

The jQuery attr() method is used to get the value of an attribute, with the attribute, for example, href. Mention the attribute as the parameter of the attr() method.

You can try to run the following code to learn how to use the attr() method to get the value of an attribute:


Live Demo

      <title>Selector Example</title>
      <script src = ""></script>
      <p><a href="" id="tpoint"> Website tutorialspoint</a></p>
      <button>Show complete link</button>