moved event.target = this out of for loop