我正在尝试通过单击按钮提交表单。
“alert 1”出现,但“alert 2”里面submit()
没有。你能告诉我为什么吗?
HTML
<body>
<form method="post" action="">
<input type=button id="send">SEND</a>
</form>
</body>
JAVASCRIPT
$('body').delegate('#send', 'click', function () {
alert('alert 1');
$('form').submit(function (event) {
alert('alert 2')
event.preventDefault()
});
});
这是我的小提琴。