出现问题,无法找到解决方案。 我正在写一个聊天。当一个新用户打开我的网站(一个新的会话)时,一个div就会出来,用户被要求填写他的名字。 当我使用输入提交时,表单工作正常。我希望它在没有提交按钮的情况下工作,我希望它能在我按div时工作。 这里是我的代码 HTML:使用jquery提交表格
<form name="form" id="form" action="index.html" method="post">
<span id="nspan">First name:</span> <input type="text" id="firstname" name="name">
<div name="enter" id="enter">Submit</div>
</form>
jquery的:
$(document).ready(function(){
$("#enter").click(function() {
$("#form").submit();
});
});
实际上,这段代码有效......问题在别的地方。 – sinisake