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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:13:26+00:00 2026-06-05T06:13:26+00:00

I am sure this has something to do with clone() but I could not

  • 0

I am sure this has something to do with clone() but I could not find anything on it. My problem is that I am adding in some HTML with anchors. Those anchors should respond to click() and then start an ajax call. I can’t seem to stop the anchors default event from working on the $(‘.term a’).

(function($) { 
$(document).ready(function() {
var item = '#main-menu li';
var http_addy = 'http://windowsdeveloper.loc';
// voacabulary id is set in the menu. If one is found then load the terms to the   menu
$('*[id*=vocabulary]:visible').each(function() {
            var voc_id = $(this).attr('id').split('-');
            var parent_li = $(this).parent('[class^=menu-]');
            $.get(http_addy + '/category/content/term_list/' + voc_id[1], function(data) {
                    $(parent_li).append(data);
            });
     });
   // use this to get the terms nodes
    $('div.term a').click(function(event){
            var url = $(this).attr('href');
            $.get(url, function(data) {
                    $('#term-nodes').append(data);                      
            });
            return false;
    });

    $(item).mouseenter(function(event){
        // Styles to show the box
            $(this).children('.vocabulary').show();
        }       
    );
    $('.navigation').mouseleave(
        function() {
            $('#main-menu li').children('.vocabulary').hide();
        }
    );
});
})(jQuery);



<ul id="main-menu" class="links inline clearfix main-menu">
<li class="menu-1050 first">
<a id="vocabulary-3" href="/newsarticletopics/windowsdeveloper">Articles</a>
<div id="term-nodes"></div>
<div id="voc-3" class="vocabulary" style="display: none;">
<div id="term-12" class="term">
    <a href="/category/content/term_nodes/12">Serien</a>
</div>
</div>
</li>
  • 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-05T06:13:28+00:00Added an answer on June 5, 2026 at 6:13 am

    It is because you are loading some content dynamically and updating the DOM. You should use jQuery on to bind your click event like this

    // use this to get the terms nodes
    $(document).on("click",".term a",function(event){
            event.preventDefault();
            var url = $(this).attr('href');
            $.get(url, function(data) {
                    $('#term-nodes').append(data);                      
            });           
    });
    

    jQuery on works for current and future elements in the DOM. on is available from jQuery 1.7+ onwards. If you are using a previous version than that, you should consider live

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

Sidebar

Related Questions

Not sure if this has been covered somewhere, but I couldn't find it in
I'm sure this has been answered before, but I really cannot find it. I
I'm sure this has been asked before, but I can't seem to find it
I'm not sure if this question has been asked before but are there any
I'm sure this has been asked, but search isn't returning the answer. In a
I'm sure this has been answered before, but I've spent the last three hours
I am sure this has to as sweet and plain as butter. But I
I'm sure this has been asked a number of time but I'm having trouble
I'm not sure if this has been answered yet, I looked at a couple
I've been doing some researching and I'm still not 100% certain if this could

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.