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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:43:13+00:00 2026-06-02T23:43:13+00:00

With jQuery 1.7x, I’m creating whole tables within dynamically generated tabs that have several

  • 0

With jQuery 1.7x, I’m creating whole tables within dynamically generated tabs that have several columns, some of which need to be clickable.

Everything seems to be wonderful except that elusive click event on dynamic content. I just learned how to do this for list items by using the .on method, but it doesn’t seem to work for my tables. (If it matters, each jQuery tab is dynamically added for a given year, and the table on that tab contains all meetings held that year)

What am I missing? I’ve got this at http://jsfiddle.net/KYkRZ/

<table>
     <tr><td><span class="ClickableClass">Is Clickable</span></td><td>Regular TD</td></tr>
</table>
<div id='myTab'></div>

$('.ClickableClass').on('click',function() {alert("ClickableClass click event") });

$('#myTab').append('<table border></table>');
var myTable = $('#myTab').children();
for(i=0;i<3;i++){
   var mySpan = $('<span></span>').addClass('ClickableClass').text('Should be clickable ' + i);
    var myTD = $('<td></td>').append( mySpan );
    var myTR = $('<tr></tr>').append( myTD );
   $(myTable).append( myTR );
}

Also, I don’t know that this is the best way to construct a table on the fly, but it was the clearest for me to understand, so any suggestions to that end would be appreciated. 🙂

  • 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-02T23:43:16+00:00Added an answer on June 2, 2026 at 11:43 pm

    You are adding the event handlers to the objects, then creating new ones and never adding event handlers to the new ones. There are two ways you can deal with this. The first is just to add event handlers after each, but that duplicates code. If you know you’re going to have dynamic content the better approach is to add the event handler to the container and tell the container to look for the click event in an element of a specific type by passing a selector to the event.

    $('body').on('click', '.ClickableClass', function() {
        alert("ClickableClass click event"); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

jQuery 1.7.1 - I'm using jQuery tabs widget in my JSP and have the
jquery update breaks when jquery, itself update input value!! i have some input boxes
jQuery 1.7.1, jQuery UI tabs. I have the following HTML representing tabs, <div id=tabs>
jQuery UI Sortable + Draggable 1.6rc5 WHAT I AM DOING: Creating a calendar with
jQuery 1.4 vs YUI3, which to use and why?
jQuery autocomplete plugin shows results that begin with the query you type into a
I have a jquery bug and I've been looking for hours now, I can't
jQuery's deferred's have never liked me, and I've never been fully able to understand
jquery attaches a click method on even things that aren't typically clickable like a
jQuery GET function does not execute. I am using a Telerik Data grid 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.