Try this: $("input[name^=link]").blur(function() { if (!/^http:\/\//.test(this.value) { this.value = "http://" + this.value; } });
Jörn On Thu, May 28, 2009 at 2:19 PM, P <pst...@gmail.com> wrote: > > In my form I have a couple of text fields into which the user enters > links. > > <input type="text" name="link1" id="link1" /> > <input type="text" name="link2" id="link2" /> > <input type="text" name="link3" id="link3" /> > > Now I want to create a function that runs after the user has entered a > link. It should automatically add "http://" in the beginning of the > link if the user forgot it. How do I do that? >