Reputation: 1374
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.
$(".star").hover(
function() {
var prevStars = $(this).prevAll();
prevStars.toggleClass('rate-btn-hover');
}
);
$("body").on("click", ".star", function() {
$(this).siblings().removeClass('rate-btn-active')
var prevStars = $(this).prevAll().addBack();
prevStars.addClass('rate-btn-active');
});
Can anyone tell me what that means ?
Upvotes: 2
Views: 297
Reputation: 1
The text of the message is suggesting substituting
.on("mouseeneter", handleEvent)
for
.hover(handleEvent)
Upvotes: 1