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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:35:42+00:00 2026-05-21T05:35:42+00:00

I want to overrule the onclick on a parent div, when an image-link in

  • 0

I want to overrule the onclick on a parent div, when an image-link in a child container is clicked.

I am using an onlick on a container called “.sight-title” to:
– change the class with toggleClass(“active”);
– change the content with an ajax call

initial state:

<div class="sight-title" id="S2851">
  <div class="row1"></div>
  <div class="row2"></div>
</div>

after clicking:

    <div class="sight-title active" id="S2851"> 
  <div class="detail1">
    <a class="wikilink" target="_blank" title="en.wikipedia.org/wiki/Marollen" href="http://en.wikipedia.org/wiki/Marollen"><img src="img/contact/culisite_wikipedia.png" border="0"></a>
  </div>
  <div class="detail2"></div>
</div>

when de the parent “.sight-title” is clicked again it changes back to the initial state.

But when the class=”wikilinks” is clicked i don’t want the onclick on the parent container to work.

jquery code: the else-part should be disabled when the class=”wikilinks” is clicked…

$(".sight-title").click(function () {
                var id=$(this).attr("id");                                      
                $("#"+id).toggleClass("active");                    
                if($(this).hasClass("active")){
                    $("#"+id).html(ajax_load);  
                    $.get(  
                     loadUrlDetail+"?id="+id+'&arrondissement='+arrondissement,  
                     {language: "php", version: 5},  
                     function(responseText){  
                         $("#"+id).html(responseText);  
                     },  
                     "html"  
                    );   
                } else {
                    $("#"+id).html(ajax_load);  
                    $.get(  
                     loadUrlTitle+"?id="+id+'&arrondissement='+arrondissement,  
                     {language: "php", version: 5},  
                     function(responseText){  
                         $("#"+id).html(responseText);  
                     },  
                     "html"  
                    );  
                }
            });
  • 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-21T05:35:42+00:00Added an answer on May 21, 2026 at 5:35 am

    Use jQuery’s unbind: http://api.jquery.com/unbind/

    $('a.wikilink').click(function() {
        //do stuff
        $('a.sight-title').unbind('click');
    });
    

    EDIT 2:

    You may need to use live instead if the link doesn’t exist when you create its click event.

    $('a.wikilink').live('click', function() {
        //do stuff
        $('a.sight-title').unbind('click');
    });
    

    EDIT:

    As a side note, you might want to make use of jQuery’s load function rather than your GETs and such.

    I think you’ll find it makes your life easier.

    You should also look at your selectors. You’re selecting the very same object you’re on with $("#"+id) instead of just doing $(this).

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

Sidebar

Related Questions

Want to run javascript function from parent window in child window Example I have
Want make a mind map like the following: Image link is not available anymore.
want to know why String behaves like value type while using ==. String s1
Want to mimic php code in c# . I want to Capture raw image
want to query below xml <courseList filedUnder=Courses> <category code=4wd title=4wd Operation> <product code=lr title=4wd
Want to add a nice multiple image upload feature to a site so I
Want to use signal when follow() function called in UserProfile. I've written signal which
Want to get current datetime to insert into lastModifiedTime column. I am using MySQL
Want to trigger itemClicked event for a QTreeWidget Item using the following code. connect(aTreeWidget,SIGNAL(itemClicked(QTreeWidgetItem*,int)),this,SLOT(CallM(QTreeWidgetItem*
Want to update page after jeditable (using gem on_the_spot) has been updated. Below works

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.