+ 1
I want to learn about the call backs in js Can you help me plz??
2 Answers
+ 5
In pure JavaScript, you could set a timer for every 3 seconds using:
time = window.setInterval(callBack, 3000);
Putting an on click callback on a button is as easy as:
document.getElementById("button").onclick=callBack;
+ 4
Hello, Sina !
The callback function is a function that is passed to another function as a parameter and that, in turn, calls the passed function.
An example of using callback functions in jQuery:
JavaScript
$('# btn').click(function() {alert('Button 1 Clicked');
});
In this example, we pass the function as a paretch to the click method, and it, in turn, calls the function passed to it.
The method of callbacks is widely used in jQuery.
https://www.sololearn.com/Course/JavaScript/?ref=app
https://www.sololearn.com/Course/jquery/?ref=app