Live Query does the trick! Another amazing piece of code from the JQuery community!
I didn't know that events wont bind to elements created after the DOM has been built the first time. And I guess that now it doesn't matter anyway! On Aug 22, 6:11 pm, duma <[EMAIL PROTECTED]> wrote: > Well, the row element doesn't exist in the document yet, so your call to > $("#10192") won't find anything. > > If you insert newrow into the document (e.g. with > $("#YourTargetElement").append(newrow)), and then do yourclickactions > (i.e. with $("#10192").click(function() {})), it should work. > > Alternatively, you could also use > thenewhttp://blog.brandonaaron.net/2007/08/19/new-plugin-live-query/Live Query > plugin! :-) It takes care of all this for you. > > Take care, and keep creating! > Sean > > > > ethanpil wrote: > > > Hi, > > Sorry to bother everyone with what is probably a stupid question, but > > I amnewto JQuery, although loving every second... > > > I have been trying to dynamically add and delete a table row on a > >clickevent, using Jquery. I am able to add and delete the row, by > > clicking on the row above it but I have not successfully been able to > > close thenewrow from inside of itself (using a link). I have spent 3 > > or 4 hours trying all different ways to attach actions to theclick > > event of the link inside mynewtable row, but no matter what I do, I > > cant even get an alert to popup from it. > > > What am I doing wrong? > > > Thanks for your time! > > > $(document).ready(function(){ > > > var newrow = \'<tr id="ticket_10192" class="ticket_info"><td > > colspan="5" scope="row"><center>NewRow</center><br><p align=right"> # > > Close </p></td></tr>\'; > > > $(\'#10192\').click(function(){ > > var e > > if( (e=$(\'#ticket_10192\')).length ) { > > // element Exists, delete it > > $(\'#ticket_10192\').remove(); > > } else { > > //Doesnt exist, create it > > $(this).after(newrow); > > } > > > }); > > $(\'a.close_ticket\').click(function(){ > > $(\'#ticket_10192\').remove(); > > }); > > }); > > -- > View this message in > context:http://www.nabble.com/Are-there-click-events-from-dynamically-added-D... > Sent from the JQuery mailing list archive at Nabble.com.