JQuery ——用一个()方法绑定事件处理程序简介(只触发一次)
1.one()方法的作用是为选中的元素绑定一个只触发一次的处理函数,其调用语法格式为:one(type,[data],fn),其中参数类型为事件类型,即需要触发什么样的事件;参数数据是一个可选参数,表示作为event.data的属性值传递给事件对象的额外数据对象;Fn是绑定事件时触发的函数。2.示例代码:复制的代码如下:DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN ' ' http://www . w3 . org/TR/XHTML 1/DTD/XHTML L1-Transitional . DTD ' html xmlns=' http://www . w3 . org/1999/XHTML ' head meta http-equiv=' Content-Type ' Content=' text/html;Charset=utf-8'/title其他事件/title script type=' text/JAVAScript ' src=' http : jquery-1 . 8 . 3 . min . js '/script type=' text/JAVAScript ' $(function())。{ $('#button ')。bind('click ',function(){ $('#button ')。attr('value ',' 14797710665 ');});})/script/headbody div输入id=' button ' type=' button ' value=' check contact information ' class=' BTN '/div/body/html 3,渲染预览:。
点击后:
再次单击无响应。
版权声明:JQuery ——用一个()方法绑定事件处理程序简介(只触发一次)是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。