jQuery模板可以绑定到原始数​​组

前端之家收集整理的这篇文章主要介绍了jQuery模板可以绑定到原始数​​组前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
特定 @H_502_2@<div id="place_holder" /> <script id="template" type="text/x-jquery-tmpl"> WHAT DO I PUT HERE </script> var array_of_ints = [1,2,3] $( "#template" ) .tmpl( array_of_ints ) .appendTo( "#place_holder" );

我可以在模板中添加什么?

@H_502_2@<ul> <li>1</li> <li>2</li> <li>3</li> </ul>

解决方法

@H_502_2@<ul id="place_holder"> </ul> <script id="template" type="text/x-jquery-tmpl"> <li>${}</li> </script> var array_of_ints = [1,3] $("#template") .tmpl(array_of_ints) .appendTo( "#place_holder" );

猜你在找的jQuery相关文章