i’m currently working in a web app and i’m using django-jquery, and when i load a set of elements via jQuery’s .load() method i need to add functionality to the new set of elemnts but it looks like the existing code doesn’t work on it, i think that i need to reload the dom tree, or use somthing like $.getScript after calling .load()
my first question is: in your opinion what is the best way to acomplish this task.
second: django encourages not to use querystrings, how much of this philosophy is practical in real world.
any comment on any of this topics is welcome.
The existing code does not work on the new elements loaded from the jQuery’s .load() function because the functions are not bound to the new elements. So use jQuery API
.live()function.If you are using jQuery 1.7 or later,
.liveis deprecated. Use.on()instead.