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 4622616
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:52:07+00:00 2026-05-22T02:52:07+00:00

My anchor tag is not working here is my code : $(‘.tree div’).click(function(){ var

  • 0

My anchor tag is not working

here is my code :

   $('.tree div').click(function(){
                    var o = $(this);
                    o.children('div').slideToggle();
                    o.filter(".parent").toggleClass("expand");
                    return false;

                });

my html code is :

 <div class="tree">
            <div class="parent">
                Parent
                <div class="parent">
                    Parent 1
                    <div>
                        <a href="http://google.com">Childe 2.1</a>
                    </div>
                    <div>
                        Childe 2.2
                    </div>
                </div>
                <div class="parent">
                    Parent 2 
                    <div>
                        one 3.1
                    </div>
                    <div>
                        one 3.2
                    </div>
                </div>
            </div>
            <div class="parent">
                Parent
                <div class="parent">
                    parent 1
                    <div>
                        Childe 2.1
                    </div>
                    <div>
                        Childe 2.2
                    </div>
                </div>
                <div class="parent">
                    parent 2
                    <div>
                        Childe 2.1
                    </div>
                    <div>
                        Childe 2.2
                    </div>
                </div>
            </div>
        </div>

but when i click on Childe 2.1 it doesn’t open google.com

Please help me.

Thanks

  • 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-05-22T02:52:08+00:00Added an answer on May 22, 2026 at 2:52 am

    I think this is what you want. The e.stopPropagation() is what I added.

    $('.tree div').click(function(e){
                    var o = $(this);
                    o.children('div').slideToggle();
                    o.filter(".parent").toggleClass("expand");
                    e.stopPropagation();
                });
    
    • Note I also added e as an argument to the function function(e).

    • Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.

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

Sidebar

Related Questions

I have an anchor tag with some simple CSS: div { background-color: gray; /*
I have an anchor tag <a class=next>next</a> made into a button. Sometimes, this tag
Consider the following code. It's an anchor tag with an id called leader-module-total that
e.preventDefault() is not working in my IE6. Could you please provide some code to
So far I have... $(document).ready(function(){ $(#AddProductButton).click(function(){ $(#product1).clone().appendTo(#products); }); With... <div id=products> <div id=product id=product1>
I want to simulate a click to an anchor tag with all extras like
how to find anchor tag in a div and push it to an array
I have error messages in anchor tag. When you click on it, it should
I have a link ( anchor ) tag in a table cell on every
How can I make the anchor tag expand to the bottom of the list

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.