You can attach an event handler to all elements that match a selector using jQuery’s on() method with the selector as the second argument. For example, to attach a click event handler to all button elements on a page, you would use the following code:
$('button').on('click', function() {
// code to handle the click event
});