Hi,
Sorry to bother everyone with what is probably a stupid question, but
I am new to JQuery, although loving every second...

I have been trying to dynamically add and delete a table row on a
click event, 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 the new row from inside of itself (using a link). I have spent 3
or 4 hours trying all different ways to attach actions to the click
event of the link inside my new table 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>New Row</center><br><p align=right"><a
href="#" id="close_ticket">Close</a></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();
    });
});

Reply via email to