Your code is saying an A tag that has an id of response. To get a jQuery
object containing all a tags inside that div, it should look like this:

#response a

That says "any A tag inside a container with an id of response".

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Massimiliano Marini
Sent: Tuesday, June 12, 2007 4:39 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Why I can't access to "a" tag in a div


$(document).ready(function(){
   $.ajax({
    type: "GET",
    url: "news.php",
    success: function(msg){
     $("#response").fadeIn("slow").html(msg);
    }
   });

   $("a#response").click(function(){
      alert("Hello");
      return false;
   });
});

<body>
 <div id="response"></div>
</body>
</html>

in "response" appear the data from $.ajax, a simple list of record :
<a href="pippo?id=1">
<a href="pippo?id=2">
<a href="pippo?id=3">

Why I can't access to the "click" event of the "a" tag in "response"
div?

--
Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/
"It's easier to invent the future than to predict it."  -- Alan Kay


Reply via email to