What is the use of jQuery.noop() function?

javascript, jquery

Solution

`$.noop` is an empty function so in your case it's returning an empty function

You can use this empty function when you wish to pass around a function that will do nothing.

This is useful for plugin authors who offer optional callbacks; in the case that no callback is given, something like jQuery.noop could execute.

Documentation found here : http://api.jquery.com/jquery.noop/

Problem

I was going through one `Backbone.js` plugin in which I found the below piece of code. ``` callbacks : { search : $.noop, valueMatches : $.noop } ``` What is the `$.noop()` function doing here?

Original source

Related problems