Joseph Izang
Joseph Izang

Reputation: 755

Jquery ajax loaded content refuses jquery to work

I am keen on mastering Codeigniter and jQuery for web app dev.

I have links where I click and they fill up a div with content and this works but I use the $.ajax({}); not get or post or load. now the thing I noticed and I know it's not new is anything I try to do with jquery on the fetched content does not work.

So even if I do a console.log() to try and catch a click event on a submit button nothing happens. The form just moves away from the page currently being worked on. So my question is what are noobs to do in this instance? is it a setting or an option?

Upvotes: 0

Views: 300

Answers (1)

code_burgar
code_burgar

Reputation: 12323

You need to use live() to bind functions to events for elements that get added after page load. Basically, live() will bind code to events firing on all existing and future elements that match a certain selector.

Upvotes: 5

Related Questions