Mastering jQuery by 2015

Mastering jQuery by 2015

Author:2015
Language: eng
Format: mobi, epub
Publisher: Packt Publishing


Although it probably has to be said that this isn't entirely representative of a real-world example, the techniques involved are nonetheless the same. The plugin is bound to the standard click handler, and will fire if the number of clicks reached is a multiple of the value stated in the configuration options for the plugin.

Namespacing events

So far, we've seen how we can delegate events and create handlers that can take custom triggers. These methods are perfect if we have a single click event handler, but what happens if we need to have multiple click handlers, for example?

Well, fortunately there's a simple solution: add a namespace to the event! Rather than talk about how it works, let's take a quick look at the following example:

$("#element") .on("click", doSomething) .on("click", doSomethingElse);



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.