Thursday, June 7, 2012

jquery add http:// value in text field if http:// is not added


jquery add http:// value in text field if http:// is not added by user

var search = $('.search');

if(search.val().indexOf('http://') != 0) {
    search.val('http://'+search.val());
}