How To Get Background Image Url In Jquery - How To Get

Dynamically Change Page/Master Page background Image in Using

How To Get Background Image Url In Jquery - How To Get. Function getbackgroundimageurl ($element) { if (! You can achieve this task by using the css() method in jquery.

Dynamically Change Page/Master Page background Image in Using
Dynamically Change Page/Master Page background Image in Using

This is all the code you need: For instance, if we have the following html: You can use the below code for getting the background image in jquery. Leave a comment on cideveloper's reply. You might want to strip out the 'url ()' part too: Return imageurl.replace (/ (url\ (|\)|'|)/gi, ''); Then we can get the value of the. // strip everything but the url itself } share. // display the url to the user alert ('image. You can achieve this task by using the css() method in jquery.

This is all the code you need: You might want to strip out the 'url ()' part too: This is required result but want to achieve the same without getting by id: Function getbackgroundimageurl ($element) { if (! ($element instanceof jquery)) { $element = $ ($element); You can use the below code for getting the background image in jquery. // display the url to the user alert ('image. For instance, if we have the following html: And here's a demonstration (using the same regex, but different code to better illustrate the process): Then we can get the value of the. You can achieve this task by using the css() method in jquery.