Call jQuery function


jquery Call jQuery function Jquery Functions

How to call the jQuery function?

Calling a jquery library function is very easy we can call the jquery function by following method.

  1. First we will get access to the DOM or HTML tag like $('div').
  2. Then we will write type of call 'when' should the function should call . E.g on click.
  3. Then with function() keyword we will start the actual function.

Example of Calling jQuery function

<script type="text/javascript"> $("button").click(function() { alert("You have clicked the button! "); }); </script>

The above function is calling an alert ' You have clicked the button! ' when any button is clicked.

Output of Calling the jQuery function of button Click

Full Source Code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <button> Click Me ! </button> <script type="text/javascript"> $("button").click(function() { alert("You have clicked the button! "); }); </script>
jquery Jquery Functions Chapter Next »