1.常用事件, 按住shift键实现同步选择效果,搜索框联想效果 2.阻止事件冒泡 3.事件委托 4.使用 $(document).ready(function (){...}) 实现文件加载完绑定事件 一.常用事件 click(function(){...}) //鼠标点击事件 hover(function(){...}) //当鼠标指针悬停在被选元素上时 blur(function(){...}) //当输入域失去焦点 (blur) 时 focus(function(){...}) //当输…
jQuery---jQ动画(普通,滑动,淡入淡出,自定义动画,停止动画),jQuery的事件,jQ事件的绑定/解绑,一次性事件,事件委托,事件冒泡,文档加载 一丶jQuery动画 show,hide,toggle /* jq对象.show(speed,回调函数) */ $('div').show(1000,fn) //显示 function fn(){ //回调函数 } /* jq对象.hide(speed,回调函数) */ $('div').hide(1000,fn) // 隐藏 functi…
jquery一次绑定多个元素事件 $(".peoplenum,input[name$='otherAmount'],#aa,#bb").bind("change", function(){ }); $("#deposit,#carAmount").bind("change",function(){ });…
兼容firefox,ie,谷歌,阻止浏览器冒泡事件,Firefox不支持event解决方法 // 获取事件function getEvent(){ if(window.event) {return window.event;} func=getEvent.caller; while(func!=null){ var arg0=func.arguments[0]; if(arg0){ if((arg0.constructor==Event || arg0.constructor ==MouseEv…
(1) 阻止默认事件 function(e){ if(e && e.preventDefault){ e.preventDefault(); }else{ //IE window.event.returnValue = false; } } (2) 阻止冒泡事件 function(e){ if(e && e.stopPropagation){ e.stopPropagation(); }else{ //IE window.event.cancleBubble = true;…
1. 作用:不再派发事件. 2. 语法: html代码: <div class="oreder-cont" ng-click="Orderdetails()"> ...... <div class="oreder-amt" ng-click="cancelCar($event)" > <span class="fz12">取消</span> </div&…
//阻止起泡取消下面的注释 e.stopPropagation(); //或者使用这种方式 //return false; }); $('.three').click(function(e){ alert('three'); //阻止起泡取消下面的注释 e.stopPropagation(); //或者使用这种方式 //return false; }); });…
//得到事件 function getEvent(){ if(window.event) {return window.event;} func=getEvent.caller; while(func!=null){ var arg0=func.arguments[0]; if(arg0){ if((arg0.constructor==Event || arg0.constructor ==MouseEvent || arg0.constructor==KeyboardEvent) ||(typ…
方法一:$('.class').on("click",function(){……}); 相当于 $('.class').bind("click",function(){……});$(document).on("click",'.class',function(){……}); 相当于 $('.class').live("click",function(){……});js生成的元素绑定事件必须使用live,但新版的jq,已经淘汰了…
科普下事件冒泡以及默认行为,以下面例子举列子:     事件冒泡:当点击内部button元素时,会触发自身及外层 a的点击事件,这就是事件冒泡引起的.事件会随着 DOM 的层次结构依次向上传播. 事件冒泡可能会引起意料之外的效果,有时候需要阻止事件的冒泡行为.     默认行为:例子中a的href跳转链接就是所谓的默认行为,或者是表单form的提交. JQuery中阻止冒泡常用到的有以下3个方法: 1:event.stopPropagation();  只阻止了冒泡事件, 默认行为没有阻止 2:…