To get the value of the target attribute of a link in JavaScript, use the target property. The target attribute is used to set where you want the linked document to open i.e. in the same window or new window or same frame, etc.
Example
You can try to run the following code to get the value of the target attribute of a link −
<!DOCTYPE html> <html> <body> <p><a id="anchorid" rel="nofollow" target= "_blank" href="https://www.qries.com/">Qries</a></p> <script> var myVal = document.getElementById("anchorid").target; document.write("Value of target attribute: "+myVal); </script> </body> </html>