This version is old school.
Please find jQuery plugins on npm.
jQuery Format URL
by Rob Lee
jQuery Format URL plugin. adds a protocol/prefix such as http:// in a textfield without interfering with what the user is typing. This is a simple plugin that makes it so when you click within an empty field, it automatically prefixes it with the protocol you choose or defaults to http://. When you click out of the field, if the field value does not contain your protocol or the default http:// it will add it. Example Usage: $('#selector').formatUrl({protocol: 'https://', alwaysShow: true});