Fixed implementation of jquery .on