Why won't this jQuery loop work?

Discussion in 'jQuery' started by enchance, Nov 26, 2008.

  1. #1
    Why won't this work? All I did was put it inside a "while" loop

    
    $(document).ready(function(){
    	var i = 1;
    	while(i <= 9){
    		$(".mp-men" + i).click(function(){
    			$("#display").attr("src", "01-bigthumb-" + i ".jpg");
    		});	
    		++i;
    	}
    });
    
    Code (markup):

     
    enchance, Nov 26, 2008 IP
  2. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    at first glance it looks ok, are you getting any errors in firebug or the error console?
     
    MMJ, Nov 26, 2008 IP