Let's invoke a function on the jQuery click() event!
We're completing these tasks in Submlime and the console.
This is an example of a click function:
$("mySelector").click(function(e) {
// e is the click data
e.preventDefault(); // this prevents the defaul click event from occuring (page loading/moving)
// click occured
});
The button abovce has an ID of button.
ready() function.ready() function, add the function above using the selector #button.
ready() function. Right below the comment // click function here.console.log("button clicked"); inside the click handler of the click function.
// click occuredbutton clicked.