here is a very simplified example of what happened
jQuery(".resultAction").each(makeItso);
function makeItso() {
//code executes (it was a conditional to test for a file extension and display apply a class)
//the short version:
jQuery(this).find("#indicator").addClass("is" + fileExtension.slice(1));
//no file extension hide the icon div "indicator"
if ((fileExtension.indexOf('.') == -1)) {
jQuery(this).find("#indicator").addClass("not");
}
}
Now, this worked well and it worked faster than .ready() -as I had about 100 results per page.
but there was one bug: on the last element it did not execute -so, I did this to re-run the function on that last item after the page loaded:
jQuery(document).ready(function(){
jQuery(".resultAction:last").each(makeItso);
});
So, to make a long story short this worked well, in Firefox, IE 7,8, 9 -though HERE is the interesting part: I tested using a Mac and VMware Fusion, sop I “thought” I was OK, the testers used their PC’s and IE 8 –Epic fail.
I leaned something: #1 testing on a Virtual machine is NOT the same as the real deal. Also my Question is why did this crash In IE 8 and otherwise run fine in 9 and in Fox? Did I code badly?
It looks like you have an element with
id="indicator"inside every.resultAction. Each ID should be unique on the page. Some browsers may not care about this restriction. Others might.Change the
id="indicator"to beclass="indicator"and it may help.As for your other problem, that it isn’t executing on the last row, you don’t need to wait for document.ready as long as you make sure the script comes later in the HTML than the elements it is manipulating. I.e. put the
<script>tag last thing before the body. If you are doing this and it isn’t working, we’ll definitely need to see the full html.