jQuery模板不起作用(jQuery 3.4.1)

时间:2019-10-24 18:55:47

标签: javascript jquery html jquery-templates

我不确定我的代码有什么问题。当我在Firefox中打开它时,它什么也没做。 但是,将其复制到fsfiddle中就可以了

我是否缺少jQuery模板的JavaScript文件,但我认为这是在1.5中添加到jQuery的 为什么

 <!DOCTYPE html>
<html>
<head>
<script src="scripts/jquery-3.4.1.js"></script>
<script src="scripts/main.js"></script>

<meta charset="UTF-8">
<title>Exam Random Generator</title>
</head>

<body>
    <div id ="mainContainer">   </div>

    <script id="questionTemplate" type="text/x-jQuery-tmpl">
        <div class="questionContainer">
            <p class="question">${sQuestionText}</p>            
        </div>
        <br/>
    </script>
    <script type="text/javascript">
        // Render the books using the template

        $("#questionTemplate").tmpl(oQuestions).appendTo("#mainContainer");
    </script>
</body>

</html> 

0 个答案:

没有答案
相关问题