This simple jquery plugin adds the option to get / set the url of the background image of the jQuery selected elements. The main point of this is just simplifying the extraction of the background image's - location in clean url-format from the element's css properties, so it can be used for other images. This is done by a simple regular expression.
(function ($) { $.fn.backgroundImageUrl = function(options) { if (options){ return this.each(function(){ $(this).css('backgroundImage','url:('+options+')'); }); }else { var pattern = /url\(|\)|"|'/g; return $(this).css('backgroundImage').replace(pattern,""); } }; })(jQuery);