Junior
What is the target attribute in HTML and what values can it take? What are its functions?
sobes.tech AI
Answer from AI
The target attribute is used to specify where the link (or form) will be opened.
It can accept the following values:
_self: Opens the link in the current window (this is the default value)._blank: Opens the link in a new window or tab._parent: Opens the link in the parent frame (if a frameset is used)._top: Opens the link in the full browser window, overriding all frames.framename: Opens the link in a named frame (if a frameset is used).
Its main function is to control the context in which a new resource is opened when activating a link or submitting a form, allowing the user to stay on the current page or open new content in a separate window/tab.
<a href="https://www.example.com" target="_blank">Open in a new tab</a>