How can I check and add http (if it does not exist) in given url using jQuery and RegEx?
I tried the following:
jQuery("#text_box_url").blur(function() {
if (jQuery(this).val()) {
if(jQuery(this).val().match(/~^(?:f|ht)tps?:/))
jQuery(this).val("http://"+jQuery(this).val());
}
});
Thanks in advance.