I want to learn about the call backs in js Can you help me plz?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I want to learn about the call backs in js Can you help me plz??

6th Jul 2018, 4:14 PM
Sina
Sina - avatar
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;
6th Jul 2018, 5:44 PM
John Wells
John Wells - avatar
+ 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
6th Jul 2018, 4:22 PM
Alexander Sokolov
Alexander Sokolov - avatar