JSFiddle - React, Tailwind, and code Playground
HTML
<form id="myform" name="theform" class="group" action="#" method="POST">
<fieldset id="changes" title="Change Validation">
<legend>Testing of Index Of</legend>
<span id="formerror" class="error"></span>
<ol>
<li>
<label for="myurl">Enter your email here</label>
<input type="url" name="myurl" placeholder="http://" id="myurl" required />
<button type="submit">send</button>
</li>
</ol>
</fieldset>
</form>
JavaScript
document.theform.myurl.onchange=function() {
var theURL = document.theform.myurl.value; // makes a variable which is equal to the value of the myurl input box in the form
if (theURL.indexOf("http://")) {
document.getElementById('formerror').innerHTML = "URL's must start with http:/"
} // if statement
} // on change