我試圖使用jquery模板(http://stanlemon.net/projects/jquery-templates.html)。jQuery模板不顯示在IE
我所試圖做的
我試圖通過JSON來獲取對象的數組,並使用jQuery模板,使它們。我得到的JSON如下
[{"type":"todo","title":"sample task","description":"this is description","tags":["todo","delete"],"objectId":"2"},{"type":"todo","title":"Do it right now","description":"you have to do everything","tags":["todo","delete"],"objectId":"3"}]
而且使用jQuery模板插件來呈現它,我做了以下
for(var i=0; i<data.length; i++)
{
var task = data[i];
//alert('hello');
$('#tasks').append($.template(taskTemplate), task);
}
會發生什麼
這工作正常,在Firefox和Chrome,但不在IE(我有V8)。 for循環被執行但沒有任何東西在#tasks div中被渲染。我注意到的奇怪的事情是,如果我取消註釋for循環中的警報,每次彈出後都會正確渲染。
可能是什麼問題?請幫忙!在此先感謝:)
IE8是否顯示控制檯中的任何JavaScript錯誤? – 2010-10-03 17:53:19
不,它不顯示任何錯誤。它表現得好像一切都很好。 – Goje87 2010-10-03 18:31:26
請在那裏添加html標記 – vittore 2010-10-03 20:15:42