简体   繁体   中英

Mootools form submit

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?

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM