Home » jQuery noop() method

jQuery noop() method

by Online Tutorials Library

jQuery noop() method

The noop() function is an empty function in jQuery. It does not accept any parameter. We can use this function when we have to pass around a function that does nothing. This method returns undefined.

Instead of declaring multiple anonymous functions, we can use the noop() function as a single empty function.

Syntax

The commonly used syntax of using the noop() function is given below –

It does not accept any arguments.

Now, let’s see an example of using the noop() method.

Example

It is a simple example of using the noop() method. Here, we are storing the value returned by the noop() method in a variable and print that variable using the innerHTML.

Test it Now

Output

After the execution of the above code, the output will be –

jQuery noop() method


You may also like