Hey all,

I was wondering if you can suggest a better way of achieving what this
snippet does. I do it often enough that it starts bloating my code and
frankly just gets annoying to type.

   var some_button = $('some-button')
   if ( some_button ) {
     some_button.observe("click",function(event){
       event.stop();
       form_object.save();
     });
   }

I can compress it a bit by doing this:

   if ( some_button = $('some-button') ) {
     some_button.observe("click",function(event){
       event.stop();
       form_object.save();
     });
   }

But that's little consolation.

In an ideal world I would want to do something close to:

   $('some-button').observe("click",function(){
     form_object.save();
   }, false );

Note: that "false" parameter would replace event.stop() which happens
often enough. Defaults to true.

Or even like (I know it looks like JQuery):

   $('some-button').click(function(){
     form_object.save();
   },false);

Any ideas/suggestions?

Thanks!
--~--~---------~--~----~------------~-------~--~----~
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