How can one achieve such a result with prototype.js?
####################
<a id="ida" href="">abc</a>
<script>
$("ida").onclick=function()
{
do_something();
return false;
}
</script>
####################
The following code doesn''t work exactly as the above one. I mean,
return false doesn''t have any effect and href is being followed
anyway.
####################
<a id="ida" href="">abc</a>
<script>$("ida").observe("click",function(){do_something();
return
false;});</script>
####################
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
$("ida").observe("click", function(e) {
e.stop(); // "Event.stop(e)" in ver <1.6
do_something();
});
- kangax
On Apr 27, 3:16 pm, Domini
<Domini...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> How can one achieve such a result with prototype.js?
> ####################
> <a id="ida" href="">abc</a>
> <script>
> $("ida").onclick=function()
> {
> do_something();
> return false;}
>
> </script>
> ####################
> The following code doesn''t work exactly as the above one. I mean,
> return false doesn''t have any effect and href is being followed
> anyway.
> ####################
> <a id="ida" href="">abc</a>
>
<script>$("ida").observe("click",function(){do_something();
return
> false;});</script>
> ####################
> Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Yeah, works, thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---