DevStud DevStud - 11 months ago 80
jQuery Question

Proper event binding

I have a question about proper event binding. I shoved my js code he said

PROPER EVENT BINDING: Consider using the preferred .on() method rather
than .click(), .bind(), .hover(), etc.

function() {
var prevStars = $(this).prevAll();
$("body").on("click", ".star", function() {
var prevStars = $(this).prevAll().addBack();

Can anyone tell me what that means ?

Answer Source

The text of the message is suggesting substituting

.on("mouseeneter", handleEvent)