- hover 由mouseenter和mouseleave组成
- $('.div1').hover(function(){
- console.log(1);
- })
- mouseenter mouseleave ★在进入子元素区域的时候不会触发$('.div1').mouseenter(function(){ console.log('mouseenter');
- })
- $('.div1').mouseleave(function(){
- console.log('mouseleave');
- })
- mouseover和 mouseout 在进入子元素区域的时候也会触发
- $('.div1').mouseover(function(){
- console.log('mouseover')
- })
- $('.div1').mouseout(function(){
- console.log('mouseout')
键盘事件
- 按下键盘时$('input[type=text]').keydown(function(){
- alert('我按下了')
- })
- 释放按键时
- $('input[type=password]').keyup(function(){
- alert('鼠标抬起了')
- })
- 产生可打印的字符时 连续敲击键盘的时候触发 */ $('input[type=password]').keypress(function(){
- alert('连续敲击键盘')
- })
- $(document).keyup(function(e){
- 敲击回车的时候触发
- if(e.keyCode==13){
- alert('我提交了')}
- })