Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How do I only target one instance of a class? Reply To: How do I only target one instance of a class?

#158328
__
Participant

Since your event handlers all do basically the same thing, you could easily have only one (maybe two) on a common parent element instead of registering each one. That can really cut down on how much work there is to do. on supports this quite easily (read about “delegated events”).