views:

54

answers:

2

Hello,

I am using JQuery onclick submit event like this

<script type="text/javascript">
$(function(){
  $('#button').click(function(){
    $('#form').submit();
    return false;
  });
});
</script>

I want to do it with mootools.

Thanks

A: 

Solved

Using mootools addEvent

 $('button').addEvent('click', function(){
        $('form').submit();            
    });
MANnDAaR
no need to return false. first off, form.submit will go to another url (unless you have a submit event handler that kills the default event). otherwise, if you want to disable the default event action, then change the callback to pass on the event:`...click": function(e) { e.stop(); // stop the click from doing anything first ...`
Dimitar Christoff
@ Dimitar Christoff : Thanks for correcting me.
MANnDAaR
A: 

If #button is a submit, you can always do the following:

$('form').addEvents({
    submit: function(){
        this.submit();
    }
});
Oskar Krawczyk