I meant:
It's because you call your var count, which is always 8...

On Jul 9, 6:34 pm, BaBna <thomas.na...@gmail.com> wrote:
> It's beacuse you call your count var, which is always 8.
> Either you redefine count in your function or you decrement it:
> $("#dataset-b tr").click(function(){
>                count = $(".count").html();
>                ...
> OR
> $("#dataset-b tr").click(function(){
>                count--;
>                ....
>
> On Jul 9, 3:46 pm, littlerobothead <nickmjo...@gmail.com> wrote:
>
> > I'm sure this is going to be an easy one. I'm just not seeing a
> > solution in any of the usual places.
>
> > I'm getting the number of elements in a table like so:
>
> > var count = $("#dataset-b tr").length;
>
> > Then appending that number to a span, like so:
>
> > $(".count").html("(" + count + ")");
>
> > What I want to do is subtract one from that number every time a user
> > clicks a row in the table I'm generating, like so:
>
> > $("#dataset-b tr").click(function(){
> >                 $(this).fadeOut(300);
> >                 var int = 1;
> >                 var prod = count - int;
> >                 $(".count").html("(" + prod + ")");
> >         });
>
> > The problem is that it works on the first click (9 changes to 8), but
> > nothing happens on subsequent clicks. Again, I'm sure this is
> > something simple I'm missing. Thanks for any help.

Reply via email to