[jQuery] Re: attaching hide() to delete confirmation
thanks, Hector, your answer helped with what I'm trying to do now. On Nov 17 2008, 1:49 pm, Hector Virgen djvir...@gmail.com wrote: If the link is within the row, you can use jQuery#parents to find the row, without using the ID. $('a.delete').click(function() { $(this).parents('tr').hide(); }); I'm not sure what .confirm() is at the end your script, but if you want to use the native javascript confirm you can do it like this: $('a.delete').click(function() { var msg = 'Are you sure?'; if (confirm(msg)) { $(this).parents('tr').hide(); } }); I hope this helps. -Hector On Mon, Nov 17, 2008 at 1:42 PM, typenerd chairman...@gmail.com wrote: Hi everyone, I'm using jquery confirm to change a link into a confirm delete yes/no. That's working great, but I'm having trouble handling deleting the row in html; I'm not sure how to reference the id for the row. My html looks like this, with each TR having a unique row id: tr id=r3 cell data... /tr my delete link looks like this: delete/3 delete row 3 my jquery looks like this, but I don't know how to reference the id=r3 using javascript: script type=text/javascript $(document).ready(function() { $('a.delete').click(function(event) { $.post($(this).attr('href'), function(data){ link_id = $(this).id(); row_id = link_id.replace('d', ''); $(#r+row_id).hide(); }); }).confirm(); }); /script -- View this message in context: http://www.nabble.com/attaching-hide%28%29-to-delete-confirmation-tp2... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: attaching hide() to delete confirmation
This is what I ended up with: $('a.delete').click(function() { var msg = 'Are you sure?'; if (confirm(msg)) { $(this).parents('tr').hide(); } else { return false; } -- View this message in context: http://www.nabble.com/attaching-hide%28%29-to-delete-confirmation-tp20548833s27240p20590531.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: attaching hide() to delete confirmation
If the link is within the row, you can use jQuery#parents to find the row, without using the ID. $('a.delete').click(function() { $(this).parents('tr').hide(); }); I'm not sure what .confirm() is at the end your script, but if you want to use the native javascript confirm you can do it like this: $('a.delete').click(function() { var msg = 'Are you sure?'; if (confirm(msg)) { $(this).parents('tr').hide(); } }); I hope this helps. -Hector On Mon, Nov 17, 2008 at 1:42 PM, typenerd [EMAIL PROTECTED] wrote: Hi everyone, I'm using jquery confirm to change a link into a confirm delete yes/no. That's working great, but I'm having trouble handling deleting the row in html; I'm not sure how to reference the id for the row. My html looks like this, with each TR having a unique row id: tr id=r3 cell data... /tr my delete link looks like this: delete/3 delete row 3 my jquery looks like this, but I don't know how to reference the id=r3 using javascript: script type=text/javascript $(document).ready(function() { $('a.delete').click(function(event) { $.post($(this).attr('href'), function(data){ link_id = $(this).id(); row_id = link_id.replace('d', ''); $(#r+row_id).hide(); }); }).confirm(); }); /script -- View this message in context: http://www.nabble.com/attaching-hide%28%29-to-delete-confirmation-tp20548833s27240p20548833.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.