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

Running an event only once

Certain applications require triggering of event handlers just once. If an event handler is wired using the .on() method, it is triggered every time the event occurs, which may be undesirable in such situations. This recipe demonstrates how to attach an event handler for one-time invocation. The constructs used in this example are summarized as follows:

Construct

Type

Description

$(".class")

jQuery selector

This matches all elements with the specified CSS class.

$("html_tag")

jQuery selector

This selects all elements with the specified HTML tag.

[attribute= "value"]

jQuery selector

This selects an element with the specified attribute equal to the value string.

click

jQuery event

This is fired when ...

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