'Deprecated jQuery pseudo selectors and on() event handler
Right now, I've seen, that some pseudo selectors are deprecated as of jQuery 3.4, for example the :last selector. Currently, I'm using these selectors to attach event handlers, like:
$('#my-table').on('click', '.btn:last', function (e) {
// ...
});
I need this style of event handling, because I'm adding rows dynamically on runtime and don't want to add a separate event handler for each row that is added.
Documentation states, that I should use last() instead of :last now. But how to use this in on() handlers like above?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
