Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8269579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:16:49+00:00 2026-06-08T06:16:49+00:00

Im trying to fade out a DIV when clicking a link within the DIV

  • 0

Im trying to fade out a DIV when clicking a link within the DIV itself. Here is my code:

$(".hideinfo").click(function () {
  var parentLink = $(this).parent().parent();               
  $(parentLink).fadeTo("slow", 0);
});

The reason I’m not specifying the ID directly is because I want to use this to fade out multiple DIVs with different ID’s.

The above code was returning the ID when I setup an alert but not fading the DIV out or anything else I tried to so… any help here would be appreciated. The HTML is:

<div id="First-Block" class="item">                 
    <p>text here</p>
    <p><a href="#" class="hideinfo">Back</a></p>    
</div>

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:16:51+00:00Added an answer on June 8, 2026 at 6:16 am

    You should use fadeOut("slow") instead.

    Try changing your code to:

    $(".hideinfo").click(function () {
        var parentLink = $(this).parent().parent();
        $(parentLink).fadeOut("slow");
    });
    

    To improve this even further you can shorten your code to:

    $(".hideinfo").click(function() {
        $(this).closest(".item").fadeOut("slow");
    });
    

    Just to mention as well that by clicking on an anchor it will jump to the top of the page using #. I would take a look at .preventDefault()

    You can also check out the API here -> http://api.jquery.com/fadeOut/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to do the following: On link click: 1.) fade out an
I'm trying to make a div fade in/out that's within an each statement. The
I'm trying to fade out a div on a click but also change some
I have been trying to make a div fade in evey 30sec and out
I'm trying to setup a function in JavaScript to fade in or fade out
I am trying to use jQuery to fade out a div, using the fadeOut
I'm trying to do a little javascript trick to fade out a div, replace
I'm trying to fade in / out some text inside a div. I've kept
im trying to make a div fade out and then have a second div
I am trying to do a delayed fade out of a div. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.