Create jQuery Selector in For loop

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!

Your code seems fine at first glance.
Could you post a link to a page where I can see this not working?