I am working on a site with around 100 images. The images all have a light and a dark version. The light has the string _lt and the dark has the string _dk. I have code that works to change the image manually.
$('img#devbprnt').mouseover(function() {
$('img#devbprnt').attr('src', 'Images/btn_devbprnt_dk.png');
});
$('img#devbprnt').mouseout(function() {
$('img#devbprnt').attr('src', 'Images/btn_devbprnt_lt.png');
});
Ideally, what I would like to do is to use $('img') as the selector and any instances of _lt to _dk on mouseover, and do the reserve on mouseout. I think this might be possible with regex, but I don't understand them well enough. Is this possible? If so, can you help point me in the right direction?
Thank you, Jason.
$('img[src$="_lt.png"]')and$('img[src$="_dk.png"]')