My code seems to be returning a null value for my image url. I would like to get just the link, but it does not seem to work.
Here is my code:
var image_url = jQuery('#bgImgWrap').css('background'), image;
// Remove url() or in case of Chrome url("")
image_url = image_url.match(/^url\("?(.+?)"?\)$/);
Here is what it returns right after the image_url is declared:
Image: rgb(255, 255, 255)
url(http://localhost:8000/mysite/images/Our_Services2.jpg)
no-repeat scroll 0% 0% / cover padding-box border-box
Here is what is returned after my regex is used:
Image: null
I am not that great with regex, but i was wondering if someone would be able to help me accomplish getting the correct background image url that i need? Thank you!