在JSP页面上提交后禁用提交表单按钮时出错

时间:2012-10-12 19:00:58

标签: jsp

所以我有一个表单,我希望在用户点击一次之后禁用表单上的“提交”按钮,以防止多次提交,我想知道如何才能实现此结果。所以代码就像这样:

<form id = "id" name= "blah" method = "post" onsubmit="$('input[type=submit]').attr('disabled', 'disabled');" ...>
items for the form goes here
<input title="Save" type="submit" value="Save" tabindex="20"/>

但是我在控制台中收到错误: “错误:属性'$'的值为null或未定义,而不是Function对象”

1 个答案:

答案 0 :(得分:1)

使用以下代码

onsubmit =“document.getElementById('submit')。disabled = 1;”

让我知道它是否有效。

相关问题