tags:

views:

29

answers:

4

I'm calling this function but I need to slideup the parent div of the link that was clicked.

This function is called from a normal link:

function close(){
    $(this).slideUp('slow', function() {

    });
}

How do i reference the element that was clicked (link), then get it's grandparent? I want to slideup not this links parent div, but the parent div of the link div.

I hope that makes sense.

A: 

Is this what you are looking for?

$('div > a').click(function() {
    $(this).parent().slideUp('slow', function() {

    });
});
Mouhannad
+1  A: 

It would be: $(this).parent().slideUp(....)

netadictos
A: 

What this function does is:

  1. binds the click on an element
  2. when element is clicked, its parent slides up

so:

function close(){
   $('elementToSlideUp').click(function(evt) {
       jQuery(this).parent().slideUp('slow');
   });
}
Anatoly G
A: 

This is what worked:

onclick="javascript:$(this).parent().slideUp('slow');"
whatshakin