web api instance property
HTMLAnchorElement: target property
The target property of the HTMLAnchorElement interface is a string that indicates where to display the linked resource.
It reflects the target attribute of the <a> element.
Value
A string representing the target. Its value can be:
- The name of a
<frame>. - One of the keyword with specific values:
_blank,_self,_parent, or_top.
Example
<a href="www.example1.com" class="link1" target="_blank">example1</a>
const link = document.querySelector(".link1");
console.log(link.target); // output: "_blank"
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.