一 事件对象
$('input').click(function(e) {
alert(e)
})
//时间戳
$('input').click(function(e) {
alert(e.timeStamp)
})
//获取触发事件名
$('input').click(function(e) {
alert(e.type)
})
//绑定的DOM元素
e.target
//获取额外的数据
$('input').band('click',123,fuction(e) {
alert(e.data);
})
传递数组[123,'abc']
//传递对象
$('input').click({user : 'Lee', age : 100},function (e) {
alert(e.data.user);
});
二 冒泡和默认行为
当我们点击按钮时,触发了按钮、div 和文档
//取消上层冒泡行为
$('input').click(function(e) {
alert('fdsdf');
e.stopPropagation();
})
禁止默认行为
//禁止提交表单
$('form').submit(function(e) {
e.preventDefault();
})