admin管理员组文章数量:1410725
This is my page.
And i got an error is
Uncaught TypeError: undefined is not a function 'appendTo'
I have not idea what happend to this.
Error occur in
$('#img-wrapper-tmpl').tmpl( {itemsCount : itemsCount} ).appendTo($rgGallery);
Can you please help this?
Thanks in advence.
This is my page.
And i got an error is
Uncaught TypeError: undefined is not a function 'appendTo'
I have not idea what happend to this.
Error occur in
$('#img-wrapper-tmpl').tmpl( {itemsCount : itemsCount} ).appendTo($rgGallery);
Can you please help this?
Thanks in advence.
Share edited Apr 24, 2014 at 10:08 Irvin Dominin 31k9 gold badges80 silver badges113 bronze badges asked Apr 24, 2014 at 10:08 Nicky LiuNicky Liu 1572 silver badges13 bronze badges 7-
2
$('#img-wrapper-tmpl').tmpl( {itemsCount : itemsCount} )
returns an empty array[]
. Therefore, trying to append it anywhere isn't going to work – Lee Taylor Commented Apr 24, 2014 at 10:12 -
2
it should like
.appendTo($("#rgGallery"))
– neel shah Commented Apr 24, 2014 at 10:12 - 1 Which jquery.tmpl library do you use? – VisioN Commented Apr 24, 2014 at 10:13
- 2 I can't find any element for $('#img-wrapper-tmpl'); what this selector is pointing to? – Irvin Dominin Commented Apr 24, 2014 at 10:14
-
1
@neelshah
var $rgGallery = $('#rg-gallery')
is in the code, so that is fine. – Lee Taylor Commented Apr 24, 2014 at 10:14
3 Answers
Reset to default 5You don't have #img-wrapper-tmpl
element in your page, that's the reason your selector is returning null or empty array and based on which you got this error.
$rgGallery.append($('#img-wrapper-tmpl').tmpl( {itemsCount : itemsCount} ));
I believe that you're missing a parameter to your .tmpl() function.
$.tmpl( template, {itemsCounts : itemsCount}).appendTo($rgGallery);
or
$.tmpl($('#img-wrapper-tmpl'), {itemsCounts : itemsCount}).appendTo($rgGallery);
Where template is a variable that contains the HTML markup of what you to render. Based on your code, you're using the this plugin.
Re: You should also specify $('#img-wrapper-tmpl')
本文标签: javascriptUncaught TypeError undefined is not a function 39appendTo39Stack Overflow
版权声明:本文标题:javascript - Uncaught TypeError: undefined is not a function 'appendTo' - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745016468a2637872.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论