[jQuery] Re: .click( ) event causes anchor-like jump

2008-08-23 Thread Kelly

Have you tried adding return false; ?


On Aug 13, 3:40 pm, cdawg <[EMAIL PROTECTED]> wrote:
> Hello Everyone,
>
> I am creating a .click() event for a TR, and then i show a row that is
> corresponding directly below it. The problem is that when the event
> fires, the browser jerks down as if the TR i clicked on was an anchor
> and goes to the TR. I do not want any behaviour like this, I just want
> it to open and the browser to stay looking at what its looking at.
>
> Code is as follows:
>
>         $(".event_heading").click(function(e) {
>
>                 e.preventDefault();
>                 e.stopPropagation();
>
>                 //Get the id
>                 var id = $(this).attr("id");
>
>                 //toggle the event
>                 toggleEvent(id);
>
>         });
>
> e.preventDefault();     and    e.stopPropagation(); dont seem to have any
> effect on this.
> the toggleEvent(id) function grabs a TR from an external source,
> inserts it directly below the heading with the given id and then
> calls .show()
>
> any help would be greatly appreciated! Thanks in advance


[jQuery] Re: .click( ) event causes anchor-like jump

2008-08-20 Thread cdawg

Ok So i found out what is going on.

When the location.hash variable is set, another event is thrown and I
have no Idea how to intercept it and stop it from jumping.



On Aug 13, 3:40 pm, cdawg <[EMAIL PROTECTED]> wrote:
> Hello Everyone,
>
> I am creating a .click() event for a TR, and then i show a row that is
> corresponding directly below it. The problem is that when the event
> fires, the browser jerks down as if the TR i clicked on was an anchor
> and goes to the TR. I do not want any behaviour like this, I just want
> it to open and the browser to stay looking at what its looking at.
>
> Code is as follows:
>
>         $(".event_heading").click(function(e) {
>
>                 e.preventDefault();
>                 e.stopPropagation();
>
>                 //Get the id
>                 var id = $(this).attr("id");
>
>                 //toggle the event
>                 toggleEvent(id);
>
>         });
>
> e.preventDefault();     and    e.stopPropagation(); dont seem to have any
> effect on this.
> the toggleEvent(id) function grabs a TR from an external source,
> inserts it directly below the heading with the given id and then
> calls .show()
>
> any help would be greatly appreciated! Thanks in advance