Work with legacy and simple sites using jQuery selectors, events, AJAX, effects, and plugins.
Lessons
Attach and remove handlers cleanly to avoid leaks.
on() and off() is easiest to learn by reading the example, changing it, and observing the result.
function handleClick() {
console.log('clicked');
}
$('#btn').on('click', handleClick); // attach
$('#btn').off('click', handleClick); // remove
$('#once').one('click', () => console.log('runs only once'));
$('#btn').trigger('click'); // fire programmaticallyPractice the on() and off() example in a small scratch file, then explain what changed and why.