[jQuery] Re: Event Firing Twice
I was wrong about it being fixed if local scripts are not included. It was throwing an error because a script did not exist, which was stopping the event stack, thus preventing the event from firing twice. I am still stumped... my stripped down version, which only contains 3 divs and very little JS code still has the event firing twice. On Nov 6, 11:49 am, n8cshaw <[EMAIL PROTECTED]> wrote: > ok, I stripped a bunch of stuff out and posted a simplified file. This > should make it easier to see what is going on. The event is still > firing twice. > > http://www.iaffectproperties.com/code/SearchForm_simple.htm > > On Nov 6, 11:21 am, MorningZ <[EMAIL PROTECTED]> wrote: > > > I took a look at the source code in the first link but there's > > too much to look at, can you be more specific about what 's, what > > selectors, and what chunk of javascript code is not doing what you > > expect it to? > > > that would help others help you > > > On Nov 6, 10:22 am, n8cshaw <[EMAIL PROTECTED]> wrote: > > > > weird, works for me... I posted it > > > athttp://www.iaffectproperties.com/code/SearchForm.htm > > > also. > > > > All of the images, css and local JS are pointing to localhost and > > > don't work obviously (JQuery and JQuery UI are being loaded from > > > Google)... as a side-effect of that, the event appears to no longer > > > run twice. I guess that tells me that some other script I am using is > > > interfering with the event and causing it to run twice? How can I > > > debug which one and prevent this from happening? I thought JQuery was > > > namespaced to prevent this? > > > > On Nov 6, 9:40 am, Liam Potter <[EMAIL PROTECTED]> wrote: > > > > > The link you provided doesn't seem to work. > > > > > n8cshaw wrote: > > > > > One more interesting note... if the parent div is visible (display: > > > > > block) when the page loads, I do not see this behavior. It is only > > > > > when the parent div is not visible (display: none) on page load that > > > > > it happens. > > > > > > On Nov 6, 9:07 am, n8cshaw <[EMAIL PROTECTED]> wrote: > > > > > >> I am attaching an event to a link. The link lets the user toggle the > > > > >> display of a child div inside of a parent div. However, when the link > > > > >> is clicked, the event is run twice (div opens and then closes > > > > >> immediately). > > > > > >> I have tried using .click() and .bind() and it makes no difference > > > > >> which one I use. I have also tried using an anonymous function versus > > > > >> a callback function and there is no difference. I tried using return > > > > >> false and e.stopPropagation() and there is no difference. I have > > > > >> triple-checked that I am not binding the event more than once in my > > > > >> code. The only way I can get it to not fire twice is to put the call > > > > >> in the link's onclick attribute. > > > > > >> I have seen several similar posts on this in the group, but I have > > > > >> not > > > > >> seen a reason why this happens or a fool-proof way to stop it from > > > > >> happening. The only thing I can think of is that one of the other JS > > > > >> libraries I am using on the page, like Matt Kruse's > > > > >> DynamicOptionList, > > > > >> etc... are interfering with the event propagation, but I don't know > > > > >> for sure if that is the cause. > > > > > >> I am moving over from Prototype/Scriptaculous and had this all > > > > >> working > > > > >> without a problem using those libraries. > > > > > >> I have posted the code at:http://jsbin.com/atiza > > > > > >> Help!
[jQuery] Re: Event Firing Twice
ok, I stripped a bunch of stuff out and posted a simplified file. This should make it easier to see what is going on. The event is still firing twice. http://www.iaffectproperties.com/code/SearchForm_simple.htm On Nov 6, 11:21 am, MorningZ <[EMAIL PROTECTED]> wrote: > I took a look at the source code in the first link but there's > too much to look at, can you be more specific about what 's, what > selectors, and what chunk of javascript code is not doing what you > expect it to? > > that would help others help you > > On Nov 6, 10:22 am, n8cshaw <[EMAIL PROTECTED]> wrote: > > > weird, works for me... I posted it > > athttp://www.iaffectproperties.com/code/SearchForm.htm > > also. > > > All of the images, css and local JS are pointing to localhost and > > don't work obviously (JQuery and JQuery UI are being loaded from > > Google)... as a side-effect of that, the event appears to no longer > > run twice. I guess that tells me that some other script I am using is > > interfering with the event and causing it to run twice? How can I > > debug which one and prevent this from happening? I thought JQuery was > > namespaced to prevent this? > > > On Nov 6, 9:40 am, Liam Potter <[EMAIL PROTECTED]> wrote: > > > > The link you provided doesn't seem to work. > > > > n8cshaw wrote: > > > > One more interesting note... if the parent div is visible (display: > > > > block) when the page loads, I do not see this behavior. It is only > > > > when the parent div is not visible (display: none) on page load that > > > > it happens. > > > > > On Nov 6, 9:07 am, n8cshaw <[EMAIL PROTECTED]> wrote: > > > > >> I am attaching an event to a link. The link lets the user toggle the > > > >> display of a child div inside of a parent div. However, when the link > > > >> is clicked, the event is run twice (div opens and then closes > > > >> immediately). > > > > >> I have tried using .click() and .bind() and it makes no difference > > > >> which one I use. I have also tried using an anonymous function versus > > > >> a callback function and there is no difference. I tried using return > > > >> false and e.stopPropagation() and there is no difference. I have > > > >> triple-checked that I am not binding the event more than once in my > > > >> code. The only way I can get it to not fire twice is to put the call > > > >> in the link's onclick attribute. > > > > >> I have seen several similar posts on this in the group, but I have not > > > >> seen a reason why this happens or a fool-proof way to stop it from > > > >> happening. The only thing I can think of is that one of the other JS > > > >> libraries I am using on the page, like Matt Kruse's DynamicOptionList, > > > >> etc... are interfering with the event propagation, but I don't know > > > >> for sure if that is the cause. > > > > >> I am moving over from Prototype/Scriptaculous and had this all working > > > >> without a problem using those libraries. > > > > >> I have posted the code at:http://jsbin.com/atiza > > > > >> Help!
[jQuery] Re: Event Firing Twice
I took a look at the source code in the first link but there's too much to look at, can you be more specific about what 's, what selectors, and what chunk of javascript code is not doing what you expect it to? that would help others help you On Nov 6, 10:22 am, n8cshaw <[EMAIL PROTECTED]> wrote: > weird, works for me... I posted it > athttp://www.iaffectproperties.com/code/SearchForm.htm > also. > > All of the images, css and local JS are pointing to localhost and > don't work obviously (JQuery and JQuery UI are being loaded from > Google)... as a side-effect of that, the event appears to no longer > run twice. I guess that tells me that some other script I am using is > interfering with the event and causing it to run twice? How can I > debug which one and prevent this from happening? I thought JQuery was > namespaced to prevent this? > > On Nov 6, 9:40 am, Liam Potter <[EMAIL PROTECTED]> wrote: > > > The link you provided doesn't seem to work. > > > n8cshaw wrote: > > > One more interesting note... if the parent div is visible (display: > > > block) when the page loads, I do not see this behavior. It is only > > > when the parent div is not visible (display: none) on page load that > > > it happens. > > > > On Nov 6, 9:07 am, n8cshaw <[EMAIL PROTECTED]> wrote: > > > >> I am attaching an event to a link. The link lets the user toggle the > > >> display of a child div inside of a parent div. However, when the link > > >> is clicked, the event is run twice (div opens and then closes > > >> immediately). > > > >> I have tried using .click() and .bind() and it makes no difference > > >> which one I use. I have also tried using an anonymous function versus > > >> a callback function and there is no difference. I tried using return > > >> false and e.stopPropagation() and there is no difference. I have > > >> triple-checked that I am not binding the event more than once in my > > >> code. The only way I can get it to not fire twice is to put the call > > >> in the link's onclick attribute. > > > >> I have seen several similar posts on this in the group, but I have not > > >> seen a reason why this happens or a fool-proof way to stop it from > > >> happening. The only thing I can think of is that one of the other JS > > >> libraries I am using on the page, like Matt Kruse's DynamicOptionList, > > >> etc... are interfering with the event propagation, but I don't know > > >> for sure if that is the cause. > > > >> I am moving over from Prototype/Scriptaculous and had this all working > > >> without a problem using those libraries. > > > >> I have posted the code at:http://jsbin.com/atiza > > > >> Help!
[jQuery] Re: Event Firing Twice
weird, works for me... I posted it at http://www.iaffectproperties.com/code/SearchForm.htm also. All of the images, css and local JS are pointing to localhost and don't work obviously (JQuery and JQuery UI are being loaded from Google)... as a side-effect of that, the event appears to no longer run twice. I guess that tells me that some other script I am using is interfering with the event and causing it to run twice? How can I debug which one and prevent this from happening? I thought JQuery was namespaced to prevent this? On Nov 6, 9:40 am, Liam Potter <[EMAIL PROTECTED]> wrote: > The link you provided doesn't seem to work. > > n8cshaw wrote: > > One more interesting note... if the parent div is visible (display: > > block) when the page loads, I do not see this behavior. It is only > > when the parent div is not visible (display: none) on page load that > > it happens. > > > On Nov 6, 9:07 am, n8cshaw <[EMAIL PROTECTED]> wrote: > > >> I am attaching an event to a link. The link lets the user toggle the > >> display of a child div inside of a parent div. However, when the link > >> is clicked, the event is run twice (div opens and then closes > >> immediately). > > >> I have tried using .click() and .bind() and it makes no difference > >> which one I use. I have also tried using an anonymous function versus > >> a callback function and there is no difference. I tried using return > >> false and e.stopPropagation() and there is no difference. I have > >> triple-checked that I am not binding the event more than once in my > >> code. The only way I can get it to not fire twice is to put the call > >> in the link's onclick attribute. > > >> I have seen several similar posts on this in the group, but I have not > >> seen a reason why this happens or a fool-proof way to stop it from > >> happening. The only thing I can think of is that one of the other JS > >> libraries I am using on the page, like Matt Kruse's DynamicOptionList, > >> etc... are interfering with the event propagation, but I don't know > >> for sure if that is the cause. > > >> I am moving over from Prototype/Scriptaculous and had this all working > >> without a problem using those libraries. > > >> I have posted the code at:http://jsbin.com/atiza > > >> Help!
[jQuery] Re: Event Firing Twice
The link you provided doesn't seem to work. n8cshaw wrote: One more interesting note... if the parent div is visible (display: block) when the page loads, I do not see this behavior. It is only when the parent div is not visible (display: none) on page load that it happens. On Nov 6, 9:07 am, n8cshaw <[EMAIL PROTECTED]> wrote: I am attaching an event to a link. The link lets the user toggle the display of a child div inside of a parent div. However, when the link is clicked, the event is run twice (div opens and then closes immediately). I have tried using .click() and .bind() and it makes no difference which one I use. I have also tried using an anonymous function versus a callback function and there is no difference. I tried using return false and e.stopPropagation() and there is no difference. I have triple-checked that I am not binding the event more than once in my code. The only way I can get it to not fire twice is to put the call in the link's onclick attribute. I have seen several similar posts on this in the group, but I have not seen a reason why this happens or a fool-proof way to stop it from happening. The only thing I can think of is that one of the other JS libraries I am using on the page, like Matt Kruse's DynamicOptionList, etc... are interfering with the event propagation, but I don't know for sure if that is the cause. I am moving over from Prototype/Scriptaculous and had this all working without a problem using those libraries. I have posted the code at:http://jsbin.com/atiza Help!
[jQuery] Re: Event Firing Twice
One more interesting note... if the parent div is visible (display: block) when the page loads, I do not see this behavior. It is only when the parent div is not visible (display: none) on page load that it happens. On Nov 6, 9:07 am, n8cshaw <[EMAIL PROTECTED]> wrote: > I am attaching an event to a link. The link lets the user toggle the > display of a child div inside of a parent div. However, when the link > is clicked, the event is run twice (div opens and then closes > immediately). > > I have tried using .click() and .bind() and it makes no difference > which one I use. I have also tried using an anonymous function versus > a callback function and there is no difference. I tried using return > false and e.stopPropagation() and there is no difference. I have > triple-checked that I am not binding the event more than once in my > code. The only way I can get it to not fire twice is to put the call > in the link's onclick attribute. > > I have seen several similar posts on this in the group, but I have not > seen a reason why this happens or a fool-proof way to stop it from > happening. The only thing I can think of is that one of the other JS > libraries I am using on the page, like Matt Kruse's DynamicOptionList, > etc... are interfering with the event propagation, but I don't know > for sure if that is the cause. > > I am moving over from Prototype/Scriptaculous and had this all working > without a problem using those libraries. > > I have posted the code at:http://jsbin.com/atiza > > Help!