proper event binding cause for soft reject


my item got soft rejected because of

  1. PROPER EVENT BINDING: Consider using the preferred .on() method rather than .click(), .bind(), .hover(), .load(), .ready(), etc. For best performance and concise code use event delegation whenever possible:

here is the jquery link.

how can i solve the matter .i have a small knowledge about please help me identify the problem.


Basically what you need to do is: bind all events using the .on() method like selector.on(‘scroll’, callback).

$(’.navbar-collapse a’).on(‘click’,function(){

It can be written like this:
$(’.navbar-collapse’).on(‘click’, ‘a’, function(){

This binds only one event to .navbar-collapse but using the bubbling it trigger on anchor links, and prevents multiple bindings like in your previous version. You bind and event for every anchor which can affect performance in big numbers.