if (!Modernizr.svg) { $("img[src$='.svg']").each(function() { var $this = $(this); $this.attr("src", $this.attr("src").replace(".svg", ".png")); }); }