JQuery Find CSS Background Image and extract name
Using Jquery to detect the URL of CSS background image, extracting the file name from the string. Regex helps out. ~ apougher
HTML
<div></div>
CSS
div{ height:53px;width:215px; background-image:url("http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif");}
JavaScript
var logo = $('div:first').css('background-image');
var cleanup = /\"|\'|\)/g;
alert(logo.split('/').pop().replace(cleanup, ''))