【问题标题】:how is once load js file to original page for .load()? [duplicate]如何将 js 文件加载到 .load() 的原始页面? [复制]
【发布时间】:2011-07-09 08:26:13
【问题描述】:

可能重复:
jQuery .load() call doesn't execute javascript in loaded html file

在使用.load() 加载的页面上,不能使用jQuery 吗? 将使用.load() 重新加载文件js 到页面加载吗? 如何在页眉中加载一次 js 文件? 这是使用 .load() 加载的内容页面

<script type="text/javascript" src="files/js/jquery-1.6.min.js"></script>
<script type="text/javascript" src="files/js/ok.js"></script>
// not want this js files (jquery-1.6.min.js - ok.js) load  here 
//i once they to page original load, with this load is twice load
<div class="insert">
    <form action="" method="post">
        <table class="servicesT" cellspacing="1">
            <tr>
                <td colspan="2" class="servHd">
                   hello
                </td>
            </tr>
            <tr>
                <td>
                    <input type="text" name="name" placeholder="name" title="name">
                </td>
                <td class="servBodL">
                </td>
                <td class="servBodL">
                </td>
            </tr>
        </table>
    </form>
</div>

【问题讨论】:

  • 真的很难理解你在问什么——你能试着改一下这个问题吗?
  • &lt;script&gt; 使用.load() 获得的内容中的标签将被忽略:stackoverflow.com/questions/1429927/…
  • @Felix,只有在同时传递了一个选择器的情况下才会对脚本进行过滤......否则整个页面都会被插入......
  • @Gaby:哦,好吧...(应该仔细阅读)...

标签: javascript jquery json jquery-plugins load


【解决方案1】:

也许你的意思是:

$("#someDiv").load("sompage.html .insert")

应该使用插入类的 div 的内容加载 someDiv。 ID 可能会更好,我不知道脚本是否已加载,firebug 会查看它们是否已加载

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-29
    • 2016-10-08
    • 1970-01-01
    相关资源
    最近更新 更多