JSFiddle - React, Tailwind, and code Playground
JavaScript
function nrm(a){
if(a.match("^https?://") || a.match("^/"))
return a;
return '/' + a;
}
$(document).on("input", "input", function(){
$("div").html(nrm(this.value));
});
$("body").append("<input><div></div>")