[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

Dynamic HTML not "seen" by jQuery

We have an ExpressionEngine module that generates some HTML and places it inside a div with a certain class.
This HTML has items that have click events in a .js file but the click events do not fire.

If I place the HTML directly into my page, not having it generated by EE, the events work.

What could I be doing wrong?
Eddie Shipman
Eddie Shipman
1 Solution
I'm guessing the EE module is generating the HTML content after the events are bound. You may benefit from use the .live() event binding instead of the normal .bind methods. If you are using .bind('click', function(){}), just change it to .live('click', function(){}). If you are using .click(function(){}), you would need to do .live('click',function(){}).

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now