gpt4 book ai didi

javascript - tmpl() 不是函数

转载 作者:行者123 更新时间:2023-11-29 20:55:57 27 4
gpt4 key购买 nike

我在 jQuery 3.3.1 项目中遇到错误 tmpl() is not a function。根据this page ,模板应该是核心的一部分,1.5版本之后。

这是我的 HTML 代码:

<script src="js/jquery-3.3.1.min.js"></script>
<script id="itemTemplate" type="text/x-jQuery-tmpl">
<tr>
<td>${title}</td>
<td><span class="fa fa-plus-square"></span>${amount}<span class="fa fa-minus-square"></span></td>
</tr>
</script>

...

<table id="basket">

这是我的 Javascript:

$("#itemTemplate").tmpl(item).appendTo("#basket");

我搜索了 jQuery 站点,但在模板上找不到任何内容。

最佳答案

看起来 jQuery 不再支持模板。

引自jquery-tmpl GitHub 上的仓库

jQuery Templates plugin vBeta1.0.0

jQuery Templates is no longer in active development, and will be superseded by JsRender. See vBeta1.0.0 tag for released beta version. Requires jQuery version 1.4.2.

Note: This is the original official jQuery Templates plugin. The project was maintained by the jQuery team as an official jQuery plugin. Since the jQuery team has decided not to take this plugin past beta, it has been returned to the principal developer's GitHub account (Boris Moore). For more information on the history of jQuery Templates, and the roadmap going forward, see jQuery Templates and JsViews: The Roadmap

关于javascript - tmpl() 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49347918/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com