Created
July 29, 2015 23:07
-
-
Save gRegorLove/3e17532d0c01114a1f0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage: onblur="absoluteURL(this);" on HTML5 'url' input | |
function absoluteURL(url) { | |
var string = url.value; | |
if ( string != '' && !(string.match(/^https?:/)) ) { | |
string = 'http://' + string; | |
} | |
else if (string == 'http://' || string == 'https://' ) | |
{ | |
string = ''; | |
} | |
url.value = string; | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment