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

  • Home
  • SEARCH
  • 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 8149527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:52:14+00:00 2026-06-06T14:52:14+00:00

I am trying to fade in a child element when a parent element is

  • 0

I am trying to fade in a child element when a parent element is clicked using jQuery, but .children() does not seem to be accomplishing what I am trying to do.

I attempting to make the <h2> element fade in when the <h1> element is clicked.

Javascript:

$(document).ready(function() {
    $('h2').hide();
    $('h1').bind('click', function() {
        $(this).children().fadeIn(400);
    });
});

Here is my code:

HTML:

<h1>
Visible Parent
    <h2>
    Hidden Child
    </h2>
</h1>

A JSFiddle of the code can be fouind here: http://jsfiddle.net/jHkAB/5/

SOLVED:

By separating the <h1> and <h2> elements and then using .next() to select the element after the <h1> element, the next element fades in when the element before it is clicked.

A JSFiddle of the code can be found here: http://jsfiddle.net/bazmegakapa/jHkAB/16/.

  • 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-06T14:52:15+00:00Added an answer on June 6, 2026 at 2:52 pm

    Heading elements (h1, h2, etc.) cannot be contained in each other, so your HTML is normalized by the browser and becomes this:

    <h1>
    Visible Parent
    </h1>
        <h2>
        Hidden Child
        </h2>
    

    That is why you animation won’t trigger, because h2 is not a child of h1 anymore.

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

Sidebar

Related Questions

I'm trying to fade an element in and out, but with a slight pause
I'm trying to fade the background-color of a span tag using JQuery to emphasize
im trying to fade in the .example element which is hidden using: .example {
I'm trying to fade in a hidden element based on the href attribute of
I'm trying to make a border fade in around an element. Following the answer
I am trying to fade a box in by using an image with a
So, I'm trying to fade in a transparent div, kinda like hulu does when
I am trying to fade in a hidden element, and then fade it back
How come the following code does not cause any fade effects? var currentTicker =0;
Im trying to have my background fade in onclick with jquery and im unsure

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.