Hi,
I’m new to javascript and am trying to create a For loop to create iterated selector class names so that i can target specific divs. Here is the code im trying to implement:
<script>
$(document).ready(function() {
$( ".tabRow" ).hide();
for ( var i = 0; i < <?php echo $this->_data['productCount']; ?>; i++ ) {
var productRowInt = '.productRow' + i;
var tabRowInt = '.tabRow' + i;
$(productRowInt).click(function() {
$(tabRowInt).toggle();
});
}
});
</script>
I can see in Firebug that the var’s have been setup but nothing is happening. How should i insert a selector from a javascript var?
Thanks!