Jets.js错误:未捕获错误:错误!找不到searchTag元素

时间:2016-08-09 02:49:51

标签: javascript

我正在尝试使用Jets.js进行一系列无序列表的页面搜索,但我一直收到这个错误:

jets.js:23 Uncaught Error: Error! Could not find searchTag element
(anonymous function) @ jets.js:23
Jets @ jets.js:17
(anonymous function) @ index.html:34

JavaScript是:

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jets/0.11.0/jets.js"></script>
    <script>
        var jets = new Jets({
          searchTag: '#jetsSearch',
          contentTag: '.jetsContent',
          searchSelector: '*OR'
        });
    </script>

,HTML是:

                            <input type="search" id="jetsSearch">
                            <ul class="jetsContent">
                                <li>
                                    <span class="icon major style1 fa-code"></span>
                                    <h3>Ipsum consequat</h3>
                                    <p>Sed lorem amet ipsum dolor et amet nullam consequat a feugiat consequat tempus veroeros sed consequat.</p>
                                </li>
                                <li>
                                    <span class="icon major style3 fa-copy"></span>
                                    <h3>Amed sed feugiat</h3>
                                    <p>Sed lorem amet ipsum dolor et amet nullam consequat a feugiat consequat tempus veroeros sed consequat.</p>
                                </li>
                                <li>
                                    <span class="icon major style5 fa-diamond"></span>
                                    <h3>Dolor nullam</h3>
                                    <p>Sed lorem amet ipsum dolor et amet nullam consequat a feugiat consequat tempus veroeros sed consequat.</p>
                                </li>
                            </ul>

1 个答案:

答案 0 :(得分:0)

试试这个:

var pre = onload;
onload = function(){
if(pre)pre();

var jets = new Jets({
  searchTag: '#jetsSearch',
  contentTag: '.jetsContent',
  searchSelector: '*OR'
});

}