jQuery keyup() 方法

jQuery 教程 · 2019-03-09 21:27:11

实例

当键盘键被松开时,设置 <input> 字段的背景颜色:

$("input").keyup(function(){ $("input").css("background-color","pink"); });

定义和用法

与 keyup 事件相关的事件顺序:

  1. keydown - 键按下的过程
  2. keypress - 键被按下
  3. keyup - 键被松开

当键盘键被松开时发生 keyup 事件。

keyup() 方法触发 keyup 事件,或规定当发生 keyup 事件时运行的函数。

提示:请使用 event.which 属性来返回哪个键被按下。

语法

触发被选元素的 keyup 事件:

  
    $(selector).keyup()

  

添加函数到 keyup 事件:

  
    $(selector).keyup(function)

  

参数 描述
function 可选。规定 keyup 事件触发时运行的函数。

点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html

查看所有标签

Agile Web Application Development with Yii 1.1 and PHP5

Agile Web Application Development with Yii 1.1 and PHP5

Jeffrey Winesett / Packt Publishing / 2010-08-27

In order to understand the framework in the context of a real-world application, we need to build something that will more closely resemble the types of applications web developers actually have to bu......一起来看看 《Agile Web Application Development with Yii 1.1 and PHP5》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具