Mootools form submit

3.6k Views Asked by At

I have this form:

 <form id="post-status-form" onsubmit="return test(this,event);" method="post">
        <textarea id="composer-textarea" class="grow" name="composer-textarea"></textarea>
        <input type="hidden" value="1" name="targetid" id="targetid" />
        </form>

with this js:

    $('composer-textarea').addEvent('keydown', function(e) {


    if(e.key == 'enter') {
        e.stop();
        $('post-status-form').submit();
    }
});

when I press enter i need to execute test() js.. How can I do?

1

There are 1 best solutions below

0
On

I tested your code with jsfiddle:

http://jsfiddle.net/PafLu/2/

and it works fine with firefox 3.6.15 and chrome 10.0.648.205.

¿Perhaps you're testing it with IE?