Reference createA()

createA()

Creates an <a></a> element that links to another web page.

The first parmeter, href, is a string that sets the URL of the linked page.

The second parameter, html, is a string that sets the inner HTML of the link. It's common to use text, images, or buttons as links.

The third parameter, target, is optional. It's a string that tells the web browser where to open the link. By default, links open in the current browser tab. Passing '_blank' will cause the link to open in a new browser tab. MDN describes a few other options.

Examples

Syntax

createA(href, html, [target])

Parameters

href

URL of linked page.

html

inner HTML of link element to display.

target

target where the new link should open, either '_blank', '_self', '_parent', or '_top'.

Notice any errors or typos? Please let us know. Please feel free to edit src/dom/dom.js and open a pull request!

Related References