Home › Forums › CSS › Javacript URL validation › Re: Javacript URL validation
October 28, 2011 at 6:24 am
#89812
Member
Try this:
$('.urlinput').keypress(function(e) {
// use e.which here, it's been normalized across browsers by jQuery
if (e.which === 13) {
var value = $(this).val();
var ini = $(this).val().substring(0, 4);
if (ini !== 'http') {
value = 'http://' + value + '/';
$(this).val(value);
}
// *** ADD your URL validation here; check "value" ***
}
});