i have a css file with a bunch of background image urls:
.alert-01 { background: url(\'img/alert-01.jpg\') center no-repeat; } .alert-02 { background: url(\'
/^url\((['"]?)(.*)\1\)$/
with jQuery :
var bg = $('.my_element').css('background-image'); // or pure js like element.style.backgroundImage bg = /^url\((['"]?)(.*)\1\)$/.exec(bg); bg = bg ? bg[2] : false; if(bg) { // Do something }
Cross with Chrome / Firefox
http://jsfiddle.net/KFWWv/