

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the value of the target attribute of a link in JavaScript?
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>
- Related Questions & Answers
- How to search the value of the target attribute of a link in JavaScript?
- How to get the value of the hreflang attribute of a link in JavaScript?
- How to get the value of the rel attribute of a link in JavaScript?
- How to get the value of the type attribute of a link in JavaScript?
- How to get the value of the id attribute a link in JavaScript?
- How to search the value of the href attribute of a link in JavaScript?
- How to search the value of the type attribute of a link in JavaScript?
- How to get the value of the usemap attribute in JavaScript?
- How to change the target of a link in HTML?
- How to get the value of the usemap attribute of an image with JavaScript?
- How to find the href attribute of a link in a document in JavaScript?
- How to get the value of id attribute in jQuery?
- How to get the value of src attribute in jQuery?
- How to get the value of custom attribute in jQuery?
- How to get an attribute value from a href link in selenium?
Advertisements