Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #20032 > unrolled thread
| Started by | "Tony" <tony.johansson@inport.com> |
|---|---|
| First post | 2013-05-29 14:15 +0200 |
| Last post | 2013-05-29 17:14 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.javascript
I want to use the passed argument to clear the table "Tony" <tony.johansson@inport.com> - 2013-05-29 14:15 +0200
Re: I want to use the passed argument to clear the table Christoph Becker <cmbecker69@gmx.de> - 2013-05-29 14:20 +0200
Re: I want to use the passed argument to clear the table "Tony" <tony.johansson@inport.com> - 2013-05-29 14:40 +0200
Re: I want to use the passed argument to clear the table Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-29 13:14 +0000
Re: I want to use the passed argument to clear the table "Tony" <tony.johansson@inport.com> - 2013-05-29 17:14 +0200
| From | "Tony" <tony.johansson@inport.com> |
|---|---|
| Date | 2013-05-29 14:15 +0200 |
| Subject | I want to use the passed argument to clear the table |
| Message-ID | <ko4r9n$fuj$1@dont-email.me> |
If I use this row
$("#myGrid tr:gt(0)").remove();
It works and all rows except the first one is removed in table with
id=myGrid
But if I use the passed argument which is myGrid in
this row
$("#" + tableID + "tr:gt(0)").remove();
it does't work.
How should I write ?
function CleanAllRows(tableID)
{
// $("#myGrid tr:gt(0)").remove();
$("#" + tableID + "tr:gt(0)").remove();
}
//tony
[toc] | [next] | [standalone]
| From | Christoph Becker <cmbecker69@gmx.de> |
|---|---|
| Date | 2013-05-29 14:20 +0200 |
| Message-ID | <ko4rq5$hi4$1@speranza.aioe.org> |
| In reply to | #20032 |
Tony wrote:
> If I use this row
> $("#myGrid tr:gt(0)").remove();
> It works and all rows except the first one is removed in table with
> id=myGrid
>
> But if I use the passed argument which is myGrid in
> this row
> $("#" + tableID + "tr:gt(0)").remove();
> it does't work.
>
> How should I write ?
Just do an
alert("#" + tableID + "tr:gt(0)");
and you'll probably can spot the error. :)
--
Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | "Tony" <tony.johansson@inport.com> |
|---|---|
| Date | 2013-05-29 14:40 +0200 |
| Message-ID | <ko4sn0$n7v$1@dont-email.me> |
| In reply to | #20033 |
I thought I found it when I wrote like this
$("#" + "tableID" + " tr:gt(0)").remove();
but I was wrong.
The only thing that seems to work is if I write like this
$("#myGrid tr:gt(0)").remove();
It anyone that have any suggestion ?
//Tony
"Christoph Becker" wrote in message news:ko4rq5$hi4$1@speranza.aioe.org...
Tony wrote:
> If I use this row
> $("#myGrid tr:gt(0)").remove();
> It works and all rows except the first one is removed in table with
> id=myGrid
>
> But if I use the passed argument which is myGrid in
> this row
> $("#" + tableID + "tr:gt(0)").remove();
> it does't work.
>
> How should I write ?
Just do an
alert("#" + tableID + "tr:gt(0)");
and you'll probably can spot the error. :)
--
Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-05-29 13:14 +0000 |
| Message-ID | <ko4uvn$23n$1@dont-email.me> |
| In reply to | #20034 |
On Wed, 29 May 2013 14:40:01 +0200, Tony wrote:
> "Christoph Becker" wrote in message
> news:ko4rq5$hi4$1@speranza.aioe.org...
>> Just do an
>> alert("#" + tableID + "tr:gt(0)");
>> and you'll probably can spot the error. :)
> I thought I found it when I wrote like this $("#" + "tableID" + "
> tr:gt(0)").remove();
> but I was wrong.
> The only thing that seems to work is if I write like this $("#myGrid
> tr:gt(0)").remove();
> It anyone that have any suggestion ?
(1) Write the reply under the original text in newsgroups.
(2) Is tableID a variable or a string?
>>> $("#" + tableID + "tr:gt(0)").remove();
Here you use tableID as a variable, but have no whitespace between
identifier and following text.
> $("#" + "tableID" + " tr:gt(0)").remove();
Here you use tableID as a string value.
Perhaps you mean to use tableID as a variable, followed by whitespace?
$("#" + tableID + " tr:gt(0)").remove();
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | "Tony" <tony.johansson@inport.com> |
|---|---|
| Date | 2013-05-29 17:14 +0200 |
| Message-ID | <ko55os$ed6$1@dont-email.me> |
| In reply to | #20034 |
I did it like this and now it works.
function CleanAllRows(tableID)
{
$("#" + tableID).find("tr:gt(0)").remove();
}
"Tony" wrote in message news:ko4sn0$n7v$1@dont-email.me...
I thought I found it when I wrote like this
$("#" + "tableID" + " tr:gt(0)").remove();
but I was wrong.
The only thing that seems to work is if I write like this
$("#myGrid tr:gt(0)").remove();
It anyone that have any suggestion ?
//Tony
"Christoph Becker" wrote in message news:ko4rq5$hi4$1@speranza.aioe.org...
Tony wrote:
> If I use this row
> $("#myGrid tr:gt(0)").remove();
> It works and all rows except the first one is removed in table with
> id=myGrid
>
> But if I use the passed argument which is myGrid in
> this row
> $("#" + tableID + "tr:gt(0)").remove();
> it does't work.
>
> How should I write ?
Just do an
alert("#" + tableID + "tr:gt(0)");
and you'll probably can spot the error. :)
--
Christoph M. Becker
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web