Easy Tutorial
❮ Coll Doc Embeds Prop Audio Muted ❯

Anchor target Attribute


Definition and Usage

The target attribute can set or return the value of the target attribute.

The target attribute specifies where to open the linked document.

Syntax

Set target attribute:

Return target attribute:

Value Description
_blank Loads the document in a new unnamed window
_self Loads the document in the same frame or window as it was clicked
_parent Loads the document into the parent frame or the frame set that contains the hyperlink
_top Loads the document into the full window, replacing any currently displayed frames
framename Loads the document into the specified frame

Browser Support

All major browsers support the target attribute.


Example

Change the target of a link:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function changeTarget(){
    document.getElementById('tutorialpro').target="_blank";
}
</script>
</head>

<body>
<a id="tutorialpro" href="//www.tutorialpro.org">Visit tutorialpro.org</a>
<br><br>
<input type="button" onclick="changeTarget()" value="Change target">
<p>Try clicking the link before you click the button.</p>

</body>
</html>

❮ Coll Doc Embeds Prop Audio Muted ❯