js was watching wrong dom element