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?
精彩评论