JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<input type="url" name="someUrl" onblur="checkURL(this)" />
<input type="text"/>
</form>
JavaScript
function checkURL (abc) {
var string = abc.value;
console.log(abc);
if (!~string.indexOf("http")){
console.log("abcd");
string = "http://" + string;
}
abc.value = string;
return abc
}