[jQuery] Hiding a row in a table

2006-11-27 Thread Bruce MacKay
Hi folks, I have a tabulated set of data (table id=tbl_assetList), with the last column of each row providing a delete it link to the following function... function fnDeleteNodeTransaction(ni,pi,ai){ $(#theIndicator3).show(); $(#tbl_assetList a).click(function(){$(tr).hide()});

Re: [jQuery] Hiding a row in a table

2006-11-27 Thread Erik Beeson
$(tr).hide() matches all tr tags and hides them. If you want to hide the tr that contained the link that was clicked, you might try something like this: $(#tbl_assetList a).click(function(){$(this).ancestors(tr).hide()}); That will hide all the TR tags that are up the DOM tree from the clicked

Re: [jQuery] Hiding a row in a table

2006-11-27 Thread Bruce MacKay
Thanks Erik, Unfortunately your line of code hid all the rows in the table, including the one that was clicked. If I just wanted to hide the row that was clicked, how would your line be altered? Bruce At 10:38 a.m. 28/11/2006, you wrote: $(tr).hide() matches all tr tags and hides them.

Re: [jQuery] Hiding a row in a table

2006-11-27 Thread Brandon Aaron
On 11/27/06, Bruce MacKay [EMAIL PROTECTED] wrote: Thanks Erik, Unfortunately your line of code hid all the rows in the table, including the one that was clicked. If I just wanted to hide the row that was clicked, how would your line be altered? You could try to just call .parent('tr')

Re: [jQuery] Hiding a row in a table

2006-11-27 Thread Erik Beeson
I just tried it and it worked fine. My guess is you don't properly close tags inside your table. Here's what I just did and it worked fine: table border=1 tr tdSome Data/td tda href=#Foo/a/td /tr tr tdSome Data 2/td tda href=#Foo/a/td /tr /table

Re: [jQuery] Hiding a row in a table

2006-11-27 Thread Erik Beeson
Not if you have well formatted tables. There should be a TD between the A and TR. You could do .parents('tr'), which is the same as ancestors. Not to hijack this thread, but maybe someone who is more familiar could share with us which function is preferred, parents or ancestors? --Erik On

Re: [jQuery] Hiding a row in a table

2006-11-27 Thread Corey Jewett
They're identical. John coded parents(), and then for semantic correctness and compatibility with XSLT added the ancestors() alias. Corey On Nov 27, 2006, at 2:26 PM, Erik Beeson wrote: Not if you have well formatted tables. There should be a TD between the A and TR. You could do

Re: [jQuery] Hiding a row in a table

2006-11-27 Thread Bruce MacKay
Yes, of course you are correct. I did think to check the table's tags for completeness, but my checking was not sufficiently thorough. Sorry for the added imposition and thanks again for the help, -- Bruce At 11:14 a.m. 28/11/2006, you wrote: I just tried it and it worked fine. My guess is