I have a javascript module which creates a div with a picture of a close button (\"X\"). This div and javascript are placed in many places on my site.
Relative path solu
Can't you just use a CSS class? If it's just a div
containing an img
, you can get rid of the img
and use background-image
on the div
. Setting this from CSS will make sure that the image path is always relative to the CSS file and will almost certainly work no matter the environment (as long as the other images in your CSS work).
Then, you can just set the className
on your div
accordingly.