Creating dynamical handlers

Creating dynamical handlers

how can i add event handlers into <div>s that were created with dynamic class names using php? i mean, i have divs with the names of "danny1","danny2","danny3","john1","john2","larissa1","chloe1","chloe2","chloe3" and so on.. is there any way i can dynamically add event handlers to each of these divs?

i tried to add a small jquery snippet within the php loop itself so it will create an handler after printing each <div> using php's echoes but it seems like a messy solution for me since it adds loads of javascript code into the source..


thansk in advance.