Jquery 的事件方法

it2022-05-05  134

1.$(selector).bind(event,data,function,map) //给元素添加一个事件

2.当元素失去焦点时发生 blur 事件,获得焦点时触发focus事件:

$("input").focus(function(){ $(this).css("background-color","#cccccc"); }); $("input").blur(function(){ $(this).css("background-color","#ffffff"); });

3.当元素被改变时触发

$(".field").change(function(){ $(this).css("background-color","#D6D6FF"); });

4.双击时候触发

$(selector).dblclick(function)

5.

转载于:https://www.cnblogs.com/Lxiaojiang/p/5929771.html


最新回复(0)