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.

Reply via email to