do event grabbing logic in js