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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:04:34+00:00 2026-05-31T05:04:34+00:00

I have a div containing information. Wraped around the div I have a ‘a’

  • 0

I have a div containing information. Wraped around the div I have a ‘a’ tag so that when a user clicks anywhere around the div the fancy box opens.

However inside the div I andother link that when clicked instead of opening the fancy box it deleted the whole div. I used return false in the click event for the delete which worked.

I have now had to add .live to the click because newly created elemnet were not getting the click event.

Since then though when I click the delete link the div does delete but the fancy box opens also.

Thanks for any help.

        $(".listContent").live('mouseenter', function(){
         $(this).fancybox({
            'type':'ajax',
            });
        });

        $("div.removeCompare").live("click", function() {
            $(this).parents(".listingContainer").remove();                                          
            return false;
        });         

Div

           <div class="listingContainer grid_9 alpha omega">                    
                <a class="listContent" href="adContent.html">
                    <div class="listingWrapper">
                        <div class="grid_8 alpha omega">
                        <div class="listingContent">
                            <div class="imgHolder">
                                <img src="imgs/cars/SearchThumb-10053325.jpg" width="100" height="75">
                            </div>
                            <div class="descHolder">
                                <div id="cars"></div>                            
                                <h3>Fancy Car</h3><div class="removeCompare">Remove</div>
                                <p>Lorem ipsum dolor sit amet, pri ex duis maiorum commune, illud viderer suscipiantur eam an. Dolorum recteque qui in. Pro inani nulla tacimates ex, qu</p>
                                <span class="listingPrice">€4,000</span>
                                <span class="listingDate">Listed: Today</span>
                                <span class="listingLocation">Co. Waterford</span>
                                <span class="listingViews">Viewed: 20 Times</span>
                            </div>
                        </div>
                    </div>
                    <div class="goTo goTo_unfocus grid_1 alpha omega">
                        <div class="gotoWrapper">
                                Click to View
                                <div class="imgVeiw"></div>

                            </div>
                        </div>
                    </div><!--End listingWrapper-->
                </a>
            </div>
  • 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-31T05:04:36+00:00Added an answer on May 31, 2026 at 5:04 am

    Updated:
    This code should most probably work.

    $(".listContent").live('click', function(e) {
        e.preventDefault();
        $(this).fancybox({
            'type': 'ajax'
        });
        console.log('inside fancybox creator');
    });
    
    $("div.removeCompare").live('mousedown', function(e) {
        e.stopPropagation();
        console.log('inside remove');
        $(this).parents(".listingContainer").remove();
    });
    

    I think your problem was with event propagation – when you click on a child element the related event of parent too fires up. So e.stopPropagation() will stop that.

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

Sidebar

Related Questions

I have a div element containing some text. When the user clicks a word
I have a div containing some text that I would like the user to
So I have a Div containing an iframe that I can Clone using JQuery.
Ok, so I have a table containing information about jobs. The goal is that
I have a series of objects containing product information that I need to use
I have a div containing an image that is positioned slightly outside of the
I have a div that contains inside 3 'floated' divs. The containing div has
I have div containing a list of flash objects. The list is long so
I have a DIV containing an image and a second DIV. The parent DIV
Say I have a div containing an unlimited number of child div s. Is

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.