Creates an external link with text wrapped in a span element
Creates an anchor element with security attributes (target="_blank" and rel="noopener noreferrer")
and wraps the link text in a span element for styling purposes.
Parameters
url: string
The href URL for the link
title: string
The text content for the link
Optionallabel: string
Optional aria-label for accessibility
Returns HTMLAnchorElement
HTMLAnchorElement with span-wrapped text
Example
constlink = createLinkWithSpan( 'https://example.com', 'Visit Example', 'Opens in a new window' ); document.body.appendChild(link);
Creates an external link with text wrapped in a span element
Creates an anchor element with security attributes (target="_blank" and rel="noopener noreferrer") and wraps the link text in a span element for styling purposes.