javascript - Remove double http:// from input using jQuery -
I have a text with a default value of http: //
. Now when the user pastes a URL (if they do not know what they are doing, like most people) it comes out like this: http: // http: //www.google.com
. I have visited a site, as soon as you have http: // http: //
, it removes one by javascript.
I'm not familiar with javascript, so anyone help me?
I do not want to clear the field only on focus.
You do not need Ajax to do just that simple javascript trick to do this.
jquery (document) .ready (function () {jQuery ('idofurtextfield'). Blur (function () {jQuery (this) .val (jQuery (this) .val (). Replace (/ (http: \ / \ /) 1 /, '$ 1'));});});
Comments
Post a Comment