Created
September 9, 2016 15:02
-
-
Save aseredenko/4ef2a75c0d1f3ff4531c50f8c2ec63c7 to your computer and use it in GitHub Desktop.
Get url from css background-image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("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