简体   繁体   English

当我使用脚本标签时,html() 在 Firefox 中不起作用

[英]html() is not working in Firefox when i`m using script tag

I am using jsrender , everything is working in Chrome, however in Firefox it`s not working.我正在使用jsrender ,在 Chrome 中一切正常,但是在 Firefox 中它不起作用。

If I try to get $('#theTmpl').html() in console (using Firefox), its coming " ".如果我尝试在控制台(使用 Firefox)中获取 $('#theTmpl').html(),它就会出现“”。 But in Chrome works perfectly.但在 Chrome 中完美运行。

Chrome:铬合金:

铬合金

Firefox:火狐:

火狐

Code:代码:

<script id="theTmpl" type="text/x-jsrender" data-jsv-tmpl="jsvTmpl">
    <div>
            {{if TotalNumberOfResults == 0 }}
            <h3>
                No Results
            </h3>
        </div><div>
            {{else}}
            <h3 id="resultFoundText" style="display:none">
                Showing [[numberone]] of [[numbertwo]] matching [[searchtext]] :
            </h3>
            {{/if}}
        </div><div class="search-result-row">
            {{for Results}}
            <h4>
                {{for Fields}}
                {{if Key == 'item_indexed_link_t'}}
                <a href="{{:Value}}" class="link-text">
                    {{/if}}
                    {{/for}}
                    {{for Fields}}
                    {{if Key == 'title_t'}}
                    {{:Value}}
                    {{/if}}
                    {{/for}}
                    {{for Fields}}
                    {{if Key == 'item_indexed_link_t'}}
                </a>
                {{/if}}
                {{/for}}
                {{for Fields}}
                {{if Key == '_templatename'}}
                <span class="category">{{:Value}}</span>
                {{/if}}
                {{/for}}
            </h4>
            {{for Fields}}
            {{if Key == 'description_t'}}
            <p>{{:Value}}</p>
            {{/if}}
            {{/for}}
            {{/for}}
        </div><div id="loadMoreResult">
            {{if TotalNumberOfResults != 0 }}
            <a class="medtouch-btn danger" onclick="FillSearch(false,  null, true)">Load More Result</a>
            {{/if}}
        </div></script>

This problem is encountered which many years if use JQuery and Firefox .使用JQueryFirefox很多年都会遇到这个问题。

Try update JQuery and Firefox to last version.尝试将JQueryFirefox更新到最新版本。

Try no JQuery :不尝试JQuery

document.getElementById("theTmpl");

Similar problems:类似问题:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM