I am using the following code to apply a hover effect to a set of images within a div called toolbar:
$("#toolbar img").hover(
function()
{
this.src = this.src.replace("_off", "_on");
},
function()
{
this.src = this.src.replace("_on", "_off");
}
);
But I also want to apply the same effect to a div called tabs without repeating the same code. cant I do something along these lines:
$("#toolbar, #tabs img").hover(
function()
{
this.src = this.src.replace("_off", "_on");
},
function()
{
this.src = this.src.replace("_on", "_off");
}
);
The problem is the above only applies to the "tabs" div, while the toolbar stops working. I think I am just getting the jQuery syntax wrong, still sorta new to jQuery