I have a list that changes depending on the search term that the user enters.
The search box has a jquery key up event and fires a ajax call to my server to get relevant search results. The data is returned as json. I then rebuild the list and add a hefty onclick function to every item in the new list.
My concern is that amount of memory used is going to get bigger and bigger as more and more events get bound to elements added through ajax.
Does jquery / javascript automatically manage elements when they are removed from the dom (free up memory)? or should I unbind all events on the list items before building the new list?
Thanks!