【发布时间】:2018-06-05 02:26:13
【问题描述】:
我有一个telerik KendoUI 模板,我将它加载到一个jQuery 对象中。这是有效的。
<script type="text/x-kendo-template" id="customKeywordsEditorPopup">
Custom Keywords
<input style="width:100%" id="inpKeywords"/>
</script>
现在这里是 JavaScript 代码,它没有给我预期的结果:
var popupHtml = $("#customKeywordsEditorPopup"); //This works
alert($(popupHtml).html()); //This outputs the HTML as expected
alert($(popupHtml).find('#inpKeywords').length); //This returns 0 instead of 1
不幸的是,$(popupHtml).find('#inpKeywords') 不返回实际元素。它应该引用 INPUT。
知道为什么这不起作用吗?
【问题讨论】:
标签: javascript jquery telerik