On Jul 9, 4:14 am, Larry Garfield <[EMAIL PROTECTED]> wrote: > You can attach a click event handler to the link, then crawl up the DOM to the > nearest div and .hide() that. > > I think something like this (untested!): > > $('a).bind('click', function () { > $(this).parents('div')[0].hide(); > > });
Just a few corrections to that: $('a').bind('click', function () { $(this).parents('div:eq(0)').hide(); }) Or more appropriate to the situation: // select 'a' within div's with a class beginning with 'box-' $('[EMAIL PROTECTED] a').bind('click', function () { $(this).parents('div:eq(0)').hide(); }) > > On Sunday 08 July 2007, gabeg wrote: > > > Apply effect to entire div holding a link > > > I have a div with class box-itemid (itemid is some numbers). Inside > > that div I have a link that when clicked, I want to hide the div the > > contains it. Is this possible in jQuery? > > > Thanks in advance for any tips/help. > > -- > Larry Garfield AIM: LOLG42 > [EMAIL PROTECTED] ICQ: 6817012 > > "If nature has made any one thing less susceptible than all others of > exclusive property, it is the action of the thinking power called an idea, > which an individual may exclusively possess as long as he keeps it to > himself; but the moment it is divulged, it forces itself into the possession > of every one, and the receiver cannot dispossess himself of it." -- Thomas > Jefferson