如何使用jQuery访问元素id和其他属性?

Hem*_*ant 3 javascript jquery

我有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.我该怎么做?更好的是访问任何属性的提示......

谢谢

red*_*are 7

提交表单的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)