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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:46:41+00:00 2026-05-30T04:46:41+00:00

Why does the JQuery script I use in all my pages seems to only

  • 0

Why does the JQuery script I use in all my pages seems to only works before beginning to browse my tabs if the content of my tabs is the same everywhere ?

I have a tab view web page built with JQuery and AJAX.

This is my JQuery functions:

$(document).ready(function(){
    $(".box .more").click(function(event){
        alert('test'); 
    });

    $("a.linkTab").click(function(event){
        var tabID = $('.linkTab')[0].toString().split('#')[1];
        $.ajax({
            url : "loadPage.php?tabID=" + tabID,
            success : function (data) {
                $('#body').html(data);
            }
        });
    });
});

This is my body web page:

<div id="header">...</div>
<div id="body">
    <div class="box">
        <p class="more">LinkLike</p>
    </div>
</div>
<div id="footer"><a href="#9">9</a></div>

loadPage.php only include needed page that Ajax script sent.

My tab system works perfectly, I can navigate in the page I want. Before navigating, When I click on the LinkLike, the alert appears. But, when I browse tabs, When I click, there is nothing.

Why does the JQuery script seems to only works before beginning to browse.

Important, the file I imports from php contains exactly the same body than the first one. The file contains:

<div class="box">
    <p class="more">LinkLike</p>
</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-30T04:46:42+00:00Added an answer on May 30, 2026 at 4:46 am

    try

    $(document).delegate(".box .more","click",function(event){
            alert('test'); 
        });
    

    the reason probably is you can generating the link dynamically, and event handlers do not attach themselves to the dynamically inserted elements to the DOM. Previously .live was used but that now is deprecated, if you are using jquery version 1.7+ you can use the .on method or else you can use the delegate method to attach the event handler to the dynamic content. However you can also re-bind the events in the success callback of ajax request

    $.ajax({
                url : "loadPage.php?tabID=" + tabID,
                success : function (data) {
                    $('#body').html(data);
                    $(".box").bind("click");
                }
            });
    

    jQuery.on version1.7+

    jQuery.delegate

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

Sidebar

Related Questions

How does jquery handle event assignment when it comes to assigning the same handler
Does a jQuery only solution exist for selecting a range of rows from a
I'm attempting to select all <script type=text/html> tags in a page. I use <script>
My jQuery slider does not work in Chrome. It only shows the navigation and
can use anything in any order? does placing of <meta http-equiv=Content-Type content=text/html;charset=UTF-8> is important
My Google Chome extension makes use of a content script declared in its manifest
I extended jquery object directly with a tween method. Does this apply to all
I'm trying to load all my website pages using jQuery .load method so, thats
Does jQuery - or one of it's plugins - have equivalent functionality to the
does jquery have any plugin that prevents entering any input to a textbox that

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.