Can you post the entire document.observe block?

occasionally I have a similar problem if an element that I am trying to
observe does not exist on the page

I wrap the observe call in

if($("elementid") != undefined)
{
   $("elementid").observe(........);
}

this will check if the elelment exists before Prototype tries to observe an
element that doesnt exist and gives up on the rest

Jason Westbrook | T: 313-799-3770 | jwestbr...@gmail.com



On Wed, Jul 18, 2012 at 9:22 AM, aaronn <aarondniel...@gmail.com> wrote:

> I am having some issues when using document.observe("dom:loaded",
> function()
>
> I have an asp page where I am trying to observe the click event on some
> elements. I load the page and click on the elments and nothing ever
> happens. So I put an alert inside of my document.observe("dom:loaded",
> function(){
>    alert("dom loaded");
>
>   // observe click events....
> });
>
> After I dismiss the alert, the click events I am trying to observe, work
> perfectly. Why do I need to have the alert in there. Is there some timing
> issue that I am not aware of? Without the alert in there I can occasionally
> get the click events to work after refreshing the page several times.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/prototype-scriptaculous/-/UF8AD5INVRgJ.
> To post to this group, send email to
> prototype-scriptaculous@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to