HTMLAnchorElement: thuộc tính target

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Thuộc tính target của giao diện HTMLAnchorElement là một chuỗi cho biết nơi hiển thị tài nguyên được liên kết.

Nó phản ánh thuộc tính target của phần tử <a>.

Giá trị

Một chuỗi đại diện cho mục tiêu. Giá trị của nó có thể là:

Ví dụ

html
<a href="www.example1.com" class="link1" target="_blank">example1</a>
js
const link = document.querySelector(".link1");
console.log(link.target); // xuất ra: "_blank"

Đặc tả kỹ thuật

Thông số kỹ thuật
HTML
# dom-a-target

Trình duyệt hỗ trợ

Xem thêm