call a function in jquery code example
Example 1: how to call function in jquery
$(document).ready(function() {
$('#btnSun').click(myFunction);
});
function myFunction() {
alert('hi');
}
Example 2: how do i call a js method?
<button onclick="sayHello()">say hello</button> <script> 'use strict'; //force the context to be undefined function sayHello() { console.log(this); console.log(arguments); console.log('hello'); } </script>