An alternative view of the problem.... If you have a PHP while() loop that outputs multiple anchors with the same id, this results in invalid HTML.
For example... <?php $i = 0; while( !empty($fish[$i]) ){ $cod = $fish[$i++]; ?> <a id='fish' href='prog.php?status=<?php echo $cod['status']; ?>&agent=<?php echo $cod['agent']; ?>' style='text-decoration:none;'><?php echo $cod['name']; ?></a> <?php } ?> ...might result in a page (or section thereof) containing a set of anchors such as... <a id='fish' href='prog.php?status=0&agent=Findus'>Finger</a> <a id='fish' href='prog.php?status=1&agent=HRamsden'>Battered</a> <a id='fish' href='prog.php?status=0&agent=Birdseye'>Breaded</a> Note that the id in each one is the same, which means that when you do a javascript (jQuery) lookup by id you will only retrieve the first occurence because the browser expects an id to be unique. The while loop needs to be changed to produce a unique id for each anchor (or no id at all). And if you need jQuery to be able find all anchors produced by this loop then assign each anchor the same class, and use that classname in the jQuery selector. Eg... <?php $i = 0; while($fish[$i]){ $cod = $fish[$i]; ?> <a id='fish<?php echo $i; ?>' class='fishy_story' href='prog.php?status=<?php echo $cod['status']; ?>&agent=<?php echo $cod['agent']; ?>' style='text-decoration:none;'><?php echo $cod['name']; ?></a> <?php } ?> jQuery selector... $('a.fishy_story').bind('click', function(){ etc,etc... }); You may still need to use LiveQuery, or some other method, if the PHP in question is serving Ajax requests to your page. On Apr 9, 6:40 am, franco57 <[EMAIL PROTECTED]> wrote: > Hi, I have this question > > have data coming from DB and put dynamicaly in a page through a while > cycle (php). How can I bind an event click to the generate html tag > (eg:<a id="link_agenzie" href="cerca2.php?cosa=<? echo > $cod['status']; ?>&agenzia=<? echo $cod['agenzia']; ?>" style="text- > decoration:none;">SOLO</a>) > > I have this code > > <script type="text/javascript"> > $(document).ready(function(){ > $("#link_agenzie").click(function(){ > var params = $(this).attr("href"); > params = params.split("?"); > $('#loading').html('<div id="loading">Caricamento in > corso ...</div>'); > $.ajax({ > url: ""+params[0]+"", > data: ""+params[1]+"&"+params[2]+"", > success: function(html){ > $("#wrapper").append(html);} > }); > });}); > > </script> > > but only the first link is working, not the subsequent > > please help > franco