Return to Snippet

Revision: 19335
at October 21, 2009 16:19 by spark9


Initial Code
$.fn.clickUrl = function() {
        var regexp = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
        this.each(function() {
            $(this).html(
                $(this).html().replace(regexp,'<a href="$1">$1</a>')
            );
        });
        return $(this);
    }

Initial URL
http://devkick.com/blog/parsing-strings-with-jquery/

Initial Description


Initial Title
Create/parse links from text in jQuery

Initial Tags
links

Initial Language
jQuery