DevStud DevStud - 1 year ago 98
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)


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download