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
String:

URL of linked page.

html
String:

inner HTML of link element to display.

target
String:

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

Returns

p5.Element: new p5.Element object.
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