I am having a reference problem in the click event, I do not know what is preventing the functionality of the jquery click function, here is my code below for analysis:
div = $('#container_principal_box_pesquisa');
contador =1;
for(i=0; i<data.length; i++){
if(i < 5){
div.append('<div id="box_pesquisa_'+contador+'">'+data[i]+'</div>');
id = $('#box_pesquisa_'+contador);
div.find('img').width(60);
div.find('img').height(60);
contador++;
}
}
box1 = $("#box_pesquisa_1");
box2 = $("#box_pesquisa_2");
box3 = $("#box_pesquisa_3");
box4 = $("#box_pesquisa_4");
box5 = $("#box_pesquisa_5");
box1.click(function(){
alert('teste');
});
The click event of the div's box1 ... up to 5 that are inside the container_principal_box_search does not work, even when doing the reference, even when I refer to the div's click event whose id is the container_principal_box_search it works normally. What could it be? Can someone help me?