admin管理员组文章数量:1336135
I have converted my ugly data parsing logic to Mustache (for ). Pretty neat stuff. I do all my development in Ubuntu/Linux so I didn't notice but the Data doesn't show up in IE.
I have traced down error to this line, the "data" is perfect, populated and as expected. Don't know why this fails.
$('#template_smslist').mustache(data).prependTo('#tab_inbox');
Here's how my template looks:
{{#sms}}
<div class="sms_recvd sms_list a">
<div class="sms_list_text">{{text}}</div>
<div class="sms_list_time">{{tstamp}}</div>
</div>
{{/sms}}
And here's how data looks like:
{"sms":[{"id":"1727591","text":"Fb shabantoo","tstamp":"1315597361"},{"id":"1727580","text":"Fb and dj shahruk rocking it again","tstamp":"1315597106"},{"id":"1727466","text":"Fb i see unicorns","tstamp":"1315595994"},{"id":"1727214","text":"Fb i see rainbows","tstamp":"1315593322"}.............
Please help!
I have converted my ugly data parsing logic to Mustache (for http://loop.pk). Pretty neat stuff. I do all my development in Ubuntu/Linux so I didn't notice but the Data doesn't show up in IE.
I have traced down error to this line, the "data" is perfect, populated and as expected. Don't know why this fails.
$('#template_smslist').mustache(data).prependTo('#tab_inbox');
Here's how my template looks:
{{#sms}}
<div class="sms_recvd sms_list a">
<div class="sms_list_text">{{text}}</div>
<div class="sms_list_time">{{tstamp}}</div>
</div>
{{/sms}}
And here's how data looks like:
{"sms":[{"id":"1727591","text":"Fb shabantoo","tstamp":"1315597361"},{"id":"1727580","text":"Fb and dj shahruk rocking it again","tstamp":"1315597106"},{"id":"1727466","text":"Fb i see unicorns","tstamp":"1315595994"},{"id":"1727214","text":"Fb i see rainbows","tstamp":"1315593322"}.............
Please help!
Share Improve this question edited Sep 10, 2011 at 19:07 DivinesLight asked Sep 10, 2011 at 18:53 DivinesLightDivinesLight 2,4152 gold badges25 silver badges30 bronze badges1 Answer
Reset to default 8I'm assuming you have the template inside a script tag, something like:
<script type="text/x-mustache-tmpl" id="template_smslist">
...
</script>
And it looks like you're using https://github./thinkdevcode/jQuery-Mustache which appears to be the problem here...
So, all it basically does is to return
$(Mustache.to_html($('#template_smslist').text(), data))
but in IE the text() calls returns nothing. Instead if html() was used it would work in all browsers.
So, my suggestion is to just do:
$(Mustache.to_html($('#template_smslist').html(), data))
本文标签: javascriptjQuery Mustache not working on IE 8Stack Overflow
版权声明:本文标题:javascript - jQuery Mustache not working on IE 8 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742376516a2463269.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论