JQuery | noop() method

This noop() Method in jQuery is the empty function when user wishes to pass around a function that will do nothing.

Syntax:

jQuery.noop()

Parameters: The noop() method does not accept any parameter.

Return Value: It returns the undefined.

Example 1: In this example, the noop() Method is used with innerHTML function.



filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JQuery | noop() method</title
  
</head>
<body style="text-align:center;"
      
    <h1 style="color: green"
        GeeksForGeeks 
    </h1
      
    <h3>JQuery | noop() method</h3>
    <button onclick="geek()">Try it</button>
    <br><br>
    <b> Value Return :</b>
    <br>
    <p id="demo"></p>
   
    <script>
    function geek() {
      var n = jQuery.noop();
      document.getElementById("demo").innerHTML = n;
    }
    </script>
</body>
</html>                                                                                            

chevron_right


Output:
Before Click:

After Click:

Example 2: In this example, the noop() Method is used with alertfunction.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JQuery | noop() method</title
  
</head>
<body style="text-align:center;"
      
    <h1 style="color: green"
        GeeksForGeeks 
    </h1
      
    <h3>JQuery | noop() method</h3>
    <button onclick="geek()">Try it</button>
      
    <script>
    function geek() {
      var n = jQuery.noop();
      alert("Value Return : " + n);
    }
    </script>
</body>
</html>                                        

chevron_right


Output:
Before Click:

After Click:




My Personal Notes arrow_drop_up

Small things always make you to think big

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.