JSFiddle - React, Tailwind, and code Playground

HTML

<a href="http://1.2/v:~-123" id="a">URL sanitization</a>

JavaScript

a.textContent = a.href;