im having some wierd problems with selecting an element with a class.
in my case i have this AJAX query, that returns some links with the same class.
when i click the link an event should happend, but it didn’t.
then i tried with makeing it alert when the an element with the class had been clicked, nothing happends, then i try to make a direct link on the page with the same class, now it gives me the alert..
what is happening ? the ajax query checks if the user is online, and does this every 1 minute, the element has the class “friend” and i try to call it by this code:
$('.friend').click(function(){
alert('clicked');
});
nothing happends with the ones displayed by the ajax request. but it responds to the links put directly onto the site.
Try using
live:It will append that handler to items that exist and items that will exist with that selector.