Using jQuery, how can I add a default value of http:// into an input field that can’t be removed, but that still allows you to type a URL after it?
http://
Defa
$("input").keyup(function(e) { var oldvalue = $(this).val(); var field = this; if (field.value.indexOf('http://') === -1 && field.value.indexOf('https://') === -1) { $(field).val('http://'); } });