views:

114

answers:

2

So i'm trying to render a template with trimpath in IE8, but when passing the template (a jquery object) there is nothing in it. This all works in chrome,safari,firefox.

So to give an example:

HTML:

<div id="flickr_image_gallery_preview_template"><!--
    <img id="flickr_detail_button" src="/devwidgets/flickr/images/external_link.gif" alt="__MSG__DELETE__" title="__MSG__DELETE__" />
    {for pic in all}
        <li class="flickr_preview"> <img src="${pic.url}" alt="${pic.title}" title ="${pic.title}" class="flickr_preview_thumb"  /></li>
    {/for}
--></div>

Javascript:

   var $flickrImageGalleryPreviewTemplate =$('#flickr_image_gallery_preview_template',rootel);
    alert($flickrImageGalleryPreviewTemplate.length)

will result in 0 in IE8 and 1 in FF,Chrome,Safari

+1  A: 

It really should work. Are you sure the DOM is ready before making that call? More code would be helpful (I have a hunch that rootel may be the culprit here).

Try calling document.getElementById('flickr_image_gallery_preview_template') and see if you get an element.

Also try running the following snippet.. it will run when the DOM is ready.

(function ($) {
    $(function() {
        alert($('#flickr_image_gallery_preview_template').length);
    });
}(jQuery));
Matt
I tried your snippet and even then it returns 0 in IE8, and again 1 in FF,chrome and safari.The document.getElementById('flickr_image_gallery_preview_template') doesn't work either.
Ojtwist
Can you link to the site? It sounds like that ID simply isn't there.
Matt
It's on localhost so i can't, the html isn't getting loaded for some reason. currently looking into this
Ojtwist
A: 

There was nothing wrong with the javascript, the html didn't get loaded properly.

Ojtwist