Wraps text nodes within links or buttons in span elements
Finds text nodes that are direct children of links or buttons and wraps them in span elements. This is useful for styling or animation purposes.
The element containing the link or button, or the link/button itself
The target element (link or button), or undefined if not found
const button = document.createElement('button');button.innerHTML = 'Click me';wrapTextNodeInSpan(button);// Result: <button><span>Click me</span></button> Copy
const button = document.createElement('button');button.innerHTML = 'Click me';wrapTextNodeInSpan(button);// Result: <button><span>Click me</span></button>
Wraps text nodes within links or buttons in span elements
Finds text nodes that are direct children of links or buttons and wraps them in span elements. This is useful for styling or animation purposes.