Search Value of Target Attribute of a Link in JavaScript



To search the value of the target attribute of a link in JavaScript, use the target property. You can try to run the following code to get the value of target attribute.

Example

<!DOCTYPE html>
<html>
   <body>
      <p><a id = "qriesid" target="_self" href = "https://qries.com/" type = "text/html" >Qries</a></p>
      <script>
         var x = document.getElementById("qriesid").target;
         document.write("Value of the target attribute: "+x);
      </script>
   </body>
</html>
Updated on: 2020-05-23T11:21:40+05:30

316 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements