If a.more is a child of the div, use this code. $(document).ready(function() { $("div.featured-cell-padding").mouseenter(function(){ $(this).find("a.more").show(); }); $("div.featured-cell-padding").mouseleave(function(){ $(this).find("a.more").hide(); }); });
On Oct 25, 1:13 am, Daniel Donaldson <d8nieldonald...@gmail.com> wrote: > I am trying to have a image (link button) appear within a div on > mousenter for the div, and disappear on mouseleave. > I have this working in the following code as expected, but I only want > it to apply to the specific div that is being entered/left. > The way I have it right now it applies to the class, so every div with > the class will trigger the function, which is not the desired effect : > ( > > What I would like to have it do is have the image show/hide only > within the specific div that is being entered/left. > Due to the nature of the project, I cannot simply apply id's to the > divs as a solution. > > The code follows, I apologize that I cannot provide a live link, it > isn't online yet, but I have pasted the code below: > > // > $('a.more').hide(); > > // > $('div.featured-cell-padding').mouseenter(function() { > $('a.more').show(); > return false; > }); > > // > $('div.featured-cell-padding').mouseleave(function() { > $('a.more').hide(); > return false; > }); > > }); > > thanks for any help/insight/words of wisdom :)