Skip to content

Instantly share code, notes, and snippets.

@aseredenko
Created September 9, 2016 15:02
Show Gist options
  • Save aseredenko/4ef2a75c0d1f3ff4531c50f8c2ec63c7 to your computer and use it in GitHub Desktop.
Save aseredenko/4ef2a75c0d1f3ff4531c50f8c2ec63c7 to your computer and use it in GitHub Desktop.
Get url from css background-image
$("div").click(function() {
var bg = $(this).css('background-image');
bg = bg.replace('url(','').replace(')','').replace(/\"/gi, "");
alert(bg);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment