Hi Everyone!
I don't think this is a hard question for all of you well versed in javascript and jQuery, but I seem to be having some problems.
I am building a forum and I am experienced in PHP, MySQL and even in jQuery now somewhat, but I have run into something I just can't seem to find the answer too. Here is a simple example which I think contains everything you need to know.
If I have 10 elements on a page, say 10 divs, and I want to hide the odd ones, I would just use $("div:odd").hide() and wrap it into the document.ready function. The page loads, the divs are hidden, awesome.
However, let's say that after the ten divs, there is a link which triggers an AJAX request and the return data is basically another 10 divs which get pasted under the ones already on the page.
What I would like to happen is that the script I wrote a paragraph ago kicks in and hides the odd divs automatically.
Now it makes sense that this does not happen, since it seems logical that when the page loads, the script parses the divs and hides stuff, so after I get the AJAX results it won't do it again. What IS weird to me is that the functions I defined don't work either, so if I define
$("div").click(function() {SOMETHING HERE})
it will work for the first set of elements, but not for the ones which are returned by the AJAX call.
Does anyone know what's going on here?
Thanks a lot!