So I have this php foreach-loop that gets data from my database.
I use a $i++ to number up the same div.
$i=0;
foreach ($pages as $page){
echo '<div class="class_'.$i++.'">
echo '</div>';
}
Now I have a piece of jQuery in my footer that does something to the <div>
<script>
jQuery(document).ready(function($){
$('.class_1');
$('.class_2');
$('.class_3');
});
</script>
Because I will never know how many instances there are I want the jQuery to add up with the foreach-loop but the script is outside the loop so it won't add up.
I don't really know my jQuery that much so any help would be appreciated.
M.
thisreference within the event handler to reference the one which raised the event.classis used for a group of elements. You could instead give them a single class with different id numbers