博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jQuery Event Menthods
阅读量:6933 次
发布时间:2019-06-27

本文共 2156 字,大约阅读时间需要 7 分钟。

Here are some common DOM events

1 Mouser Events

click dbclick mouseenter mouseleave

2 Keyborars Events

keypress keydown keyup

3 Form Events

submit change focus blus

4 Docment/Wiindow Events

laod resize scroll unload

click()

the function is executed when the user clicks on the html element.
eg:

$("p").click(function(){    $(this).hide();})

dblclick()

the dblclick() method attaches an event handlerfunction to an html element. the function is executed when the user double-clicks on the html element

eg:

$("p").dblclick(function(){    $(this).hide();})

mouseenter()

the function is executed when the mouse pointer the html element
eg:

$("p").mouseenter(function(){    alert("you entered p");})

mouseleave()

the function is executed when the mouse pointer leaves the html element

eg:

$("#p").mouseleave(function(){    alert("bye! you now leave p");    })

mousedown()

the function is executed , when the left,middle or right button is pressed down, while the mouse is over the html element
eg:

$("p").mousedown(function(){    alert("mouse down over p");})

mouseup()

the function is excuted, when the left.midddle or right mouse button is released while the nouse is over the html element

eg:

$("p").mouseup(function(){alert("mouse up over p");})

hover()

the hover() method takes two functions and is a combination of the mouseenter() and mouseleave() methods
the first function is executed when the mouse enters enters the html element, and the second function is executed when the mouse leaves the html element

eg:

$("p").hover(function(){alert("you entered p");},funtion(){alert("bye! you now leave p");})

focus()

the focus() methods attaches an event handler function to an html form the function is executed when the form field gets focus

eg:

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

blur()

the blur() method attaches an eveent handler function to an html
the function is executed when the form field loses focus

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

on()

the function attaches one or more event handlers for selected selected
elements
eg:

$("p").on("click",function(){$(this).hide();})

转载地址:http://ilmjl.baihongyu.com/

你可能感兴趣的文章
我的友情链接
查看>>
读《计算机网络——潘爱明》后感
查看>>
Java内存分配浅析2
查看>>
bash 特性详解需整理
查看>>
spring中service调用service的事务控制
查看>>
dubbo学习之dubbo管理控制台装配及集成zookeeper集群部署(1)【转】
查看>>
jsp提交登陆信息,servlet返回一个html页面(不做验证,无数据库)
查看>>
CentOS7 使用的定制
查看>>
SSM(九)反射的实际应用-构建日志对象
查看>>
CSS技巧收集
查看>>
装饰模式
查看>>
Redis+Mysql模式和内存+硬盘模式的异同
查看>>
Android第二十七天
查看>>
[转].NET StockTrader 6 Sample Application
查看>>
[Windows Azure] How to Manage Cloud Services?
查看>>
SpringCloud中Feign调Token丢失解决办法
查看>>
centos6 配置vlan trunk口
查看>>
----- java导出xml
查看>>
springboot-项目属性配置
查看>>
<a> href Post提交请求
查看>>