Closed mnbeer closed 6 years ago
Hi,
While I do not think that blur()
method would be deprecated - https://api.jquery.com/blur/ - I'll replace with trigger
. Thanks.
Thanks. See: https://github.com/jquery/jquery-migrate/blob/master/warnings.md
JQMIGRATE: jQuery.fn.click() event shorthand is deprecated Cause: The .on() and .trigger() methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
Solution: Instead of .click(fn) use .on("click", fn). Instead of .click() use .trigger("click").
Interestingly, there are still debates whether to deprecate .on() or not - https://github.com/jquery/jquery/issues/3214
I think it can be confidently assumed that removal isn't going to happen for a long time, even if deprecated. But it is clear that on() and trigger() are now considered "best practice". So, it makes sense to do that.
Should the following:
be
?
The line is kicking up a warning in jQuery Migrate.