What value is in "r"? Does it have something like a # or . that makes it a valid selector?
For example, in your code below: var blocco = r + " div.pul"; $(blocco).each(function (i) blocco may become 'testdiv.pul' $(blocco), will become $('testdiv.pul'), which does nothing because there's no element named 'testdiv'. What you're trying to achieve maybe $('#testdiv.pul') or $ ('.testdiv.pul'). On Oct 30, 9:51 am, ammaccabanane <pe...@msn.com> wrote: > Hi all. > I'm searching for a solution to this problem: i've put a div (passed to the > function with "r") with inside three div with class "pul". These has the > function: > > function clic(r){ > var blocco = r + " div.pul"; > $(blocco).each(function (i) > { > $("#bloccofoto1").hide(); > $("#bloccofoto2").hide(); > $("#bloccofoto3").hide(); > $(document.getElementById("elencofoto")).hide(); > $(this).click( > function() { > $(document.getElementById("mostrafoto")).css("height","22.65em"); > $(document.getElementById("elencofoto")).fadeIn("slow"); > $(document.getElementById("elencofoto")).css("height","6.7em"); > if (i==0) { $("#bloccofoto1").show("slow"); $("#bloccofoto2").hide(); > $("#bloccofoto3").hide(); } > else if (i==1) { $("#bloccofoto2").show("slow"); $("#bloccofoto1").hide(); > $("#bloccofoto3").hide(); } > else { $("#bloccofoto3").show("slow"); $("#bloccofoto1").hide(); > $("#bloccofoto2").hide(); }; > > } > ); > }); > } > > So that they make visible a div("elencofoto") that contains three hide span > (that contain img) by the number that comes from the "i" of the "each". > These spans have their own spans. For example "exnovo": > > function clicimgex(e){ > var gruppoimmagini = e + " img.novo"; > $(gruppoimmagini).each(function (i) > { > $(this).click( > function() { > alert('Are you sure you want to give us the deed to your house?'); <---- > inserited as a test > document.getElementById("cambiaimmagine").src="exnovo/"+i+".jpg"; > > } > ); > }); > } > > This one should take the img that has been clicked (with the "each()") and > by the "i" in each() changes the "src" attribute of the image (with name > 0.jpg, 1.jpg, 2.jpg eccetera.. that finds in the folder) that i put in > another div ("cambiaimmagine", that is inside "mostrafoto_img", that is > inside "mostrafoto"). > Why? > This image is bigger than the previous, so that you can see it bigger. > This all runs in Firefox and Safari, not on IE 6 and 7. > I tried to put the alert out of the "click()" and it runs, but inside not. > What can i do? > > PS: i tried to use livequery, but i found it hard to implement, so if it's a > good idea can you help me? > > Thanks all > -- > View this message in > context:http://old.nabble.com/Click-not-running-on-IE-tp26136003s27240p261360... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.