开发者

Mootools form submit

开发者 https://www.devze.com 2023-02-26 20:10 出处:网络
I have this form: <form id=\"post-status-form\" onsubmit=\"return test(this,event);\" method=\"post\">

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 e开发者_开发知识库nter 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消