Hi,

If you search this group for things like "fire native event", that
kind of thing, you should find several threads on it.  I think the
short answer is that there is no reliable, cross-browser way to do
it.  But there are some workarounds, particularly if you only want to
call handlers registered through Prototype.

Usually, though, this kind of requirement suggests a bit of
refactoring is appropriate.  Rather than wanting to fire the click
event, usually it's that you want to trigger the same behavior that
the click event triggers.  In that case, usually it's best to have
both the click event and the other code calling a common, separate
function.

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Feb 20, 12:32 pm, marioosh <[email protected]> wrote:
> hello;) i have code like below. I need to simulate click on #log_in
> button when i press enter on input fields. My code doesnt work. Why ?
> What can i do to make this works ?
>
> [cut]
>                 $(this.elContainer).down('#log_in').observe('click', 
> function() {
>                                                 this.login();
>                                         }.bind(this));
>
>                                         
> $(this.elContainer).select('input').each(function(el){
>                                                 el.observe('keypress', 
> function(event) {
>                                                         if(event.keyCode == 
> '13') {
>                                                                 
> $(this.elContainer).down('#log_in').fire('click');
>                                                                 
> //this.login();
>                                                                 
> //Event.stop(event);
>                                                         }
>                                                 }.bind(this));
>                                         }.bind(this));
>
> [cut]
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to