Tuesday, December 30, 2008

[jQuery] Re: Please help me on a .lt method

Thanks all the same。 I've got it solved. Actually the problem is that .lt and .gt were removed from the newly released jquery.

Thanks.

On Wed, Dec 31, 2008 at 1:10 PM, Kean <shenanime@gmail.com> wrote:

Make a demo page or a html page.

Some common mistakes

1. Did you include jQuery?
2. Did you write something like
var $table =$('table') before using  $table.find() ?


On Dec 30, 7:30 pm, Samuel Wu <Samuel.YH...@gmail.com> wrote:
> Hi, everyone
>
> I started writing jquery from last week with the help from a very good
> book Learning Jquery.
>
> I met a problem when reading the book, which has the script:
>
> <code>
> $table.find('tbody tr').show()
> .lt(2)
> .hide()
> .end()
> .gt(5)
> .end();
> </code>
>
> Where 2 and 5 are different from the book, but I think it has no
> effect to the problem.
>
> I haven't met a lt or gt method before, I can only write
> <code>
>     $table.find('tbody tr:lt(2)').hide();
>     $table.find('tbody tr:gt(5)').hide();
> </code>
>
> I tried the author's code, which didn't work on my browser. the
> browser said
> "TypeError: $("table").find("tbody tr").show().lt is not a function"
>
> I also tried this way:
> <code>
> var $trow=$table.find('tbody tr')
> $trow.lt(2).hide()
> <code>
>
> the problem still exists there.
>
> My question is:
> Is lt or gt a method used as a  selector ?
> If I want to implement the chain actions like the first code, how
> could I do that?
>
> Any help is appreciated. thanks very much. Happy new year.



--
Samuel Wu

No comments: