我有JavaScript方法,当提交表单的特定类(mcb)时,它会起作用:
function BindCloseMessage() {
$(".mcb").submit(function(event) {
alert("closing..."); //Here I want to get the id of form
event.preventDefault();
});
}
Run Code Online (Sandbox Code Playgroud)
代替警报调用,我需要访问其提交被调用的表单的id.我该怎么做?更好的是访问任何属性的提示......
谢谢
提交表单的ID将是
this.id
Run Code Online (Sandbox Code Playgroud)
或者在jQuery中
$(this).attr('id') //although why type the extra letters?
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5743 次 |
| 最近记录: |