O'Reilly logo

ASP.NET jQuery Cookbook - Second Edition by Sonal Aneel Allana

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Responding to keyboard events

This recipe demonstrates how to write an event handler for a common keyboard event, keyup, which is triggered when a key is released. The constructs used in this example are as follows:

Construct

Type

Description

$("#identifier")

jQuery selector

This selects an element using its ID.

$(this)

jQuery object

This refers to the current jQuery object.

.addClass()

jQuery method

This adds the specified CSS class to each matched element.

keyup

jQuery event

This is fired when a key is released. It corresponds to the JavaScript keyup event.

.length

JavaScript property

This returns the length of the string.

.on()

jQuery event binder

This attaches an event handler for one or more events to the matched ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required