I have main page where I define a DIV with id “mydiv”. Then I use ajax to load some linked text inside that DIV.
Now I want to do something when anybody click on those links, so I defined my jquery like below.
$("#mydiv > a").live('click',function(){
alert($(this).text());
});
The loaded contents are in the below form
<a style="cursor:pointer;">Text 1</a>
<a style="cursor:pointer;">Text 2</a>
<a style="cursor:pointer;">Text 3</a>
Anybody please tell me what i am doing wrong?
Thanks,
since you are loading the content inside
DIV with id "mydiv"dynamically (by ajax)….use on delegate event