[jQuery] Re: switching two table rows

2009-06-14 Thread Karl Swedberg
Assuming that the Move Up link is within the table row and that the link has a class of moveup, you could do something like this: $('a.moveup').click(function() { var $thisRow = $(this).parents('tr:first'); $thisRow.insertBefore( $thisRow.prev() ); return false; }); --Karl

[jQuery] Re: switching two table rows

2009-06-14 Thread Paul Witschger
Thank you, Karl!! Works excellent. Exactly what I needed! Karl Swedberg wrote: Assuming that the Move Up link is within the table row and that the link has a class of moveup, you could do something like this: $('a.moveup').click(function() { var $thisRow = $(this).parents('tr:first');

[jQuery] Re: switching two table rows

2009-06-14 Thread John Bill
good job! 2009/6/15 Paul Witschger tigerseyet...@gmail.com Thank you, Karl!! Works excellent. Exactly what I needed! Karl Swedberg wrote: Assuming that the Move Up link is within the table row and that the link has a class of moveup, you could do something like this:

[jQuery] Re: switching two table rows

2009-06-14 Thread Paul Witschger
actually, there is one problem. I guess what I need is something a little different. Basically the same, but I need to know if the row is at the end or beginning of the list. If a row is moving into the first spot, I need to remove the Move Up link. Same with the row moving down (removing

[jQuery] Re: switching two table rows

2009-06-14 Thread Karl Swedberg
Hi Paul, This will do the trick, but it could be written a lot more elegantly (it's midnight here, and I only had a few minutes to bang something out): $(document).ready(function() { $('tr:first-child .moveup').hide(); $('tr:last-child .movedown').hide();

[jQuery] Re: switching two table rows

2009-06-14 Thread Paul Witschger
Karl, Midnight or not, your code is awesome. I only had to make one tiny alteration (to handle the table heading row), and it worked beautifully. Thanks a lot for your help. Paul Karl Swedberg wrote: Hi Paul, This will do the trick, but it could be written a lot more elegantly (it's