Skip to Content
Introducing .NET 4.0: with Visual Studio 2010
book

Introducing .NET 4.0: with Visual Studio 2010

by Alex Mackey
February 2010
Beginner content levelBeginner
400 pages
11h 13m
English
Apress
Content preview from Introducing .NET 4.0: with Visual Studio 2010

12.9. Customizing jQuery

You can add your own functions to the jQuery library. For example, to create a simple function that will pop up an alert box, you can do so with the following code:

//don't use $ alias in case user overrides it
jQuery.fn.say = function (message) {
    alert("jQuery says " + message);

    return this;
}

You can then call the new function with the following code:

$.fn.say("hello").say("good bye");

And there is, of course, no reason why you couldn't write a new effects function and use it as part of a chain of effects.

For more information, please refer to http://docs.jquery.com/Plugins/Authoring.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ASP.NET 3.5 For Dummies®

ASP.NET 3.5 For Dummies®

Ken Cox
ASP.NET 4 Unleashed

ASP.NET 4 Unleashed

Stephen Walther, Kevin Hoffman, Nate Dudek

Publisher Resources

ISBN: 9781430224556Purchase book