【问题标题】:jquery prepend to a div html file contentjquery 附加到 div html 文件内容
【发布时间】:2012-08-30 16:34:46
【问题描述】:

如何做到这一点

$('#RibbonContainer-TabRowRight').prepend(load('~/_layouts/1033/nav.html'));

类似这样的东西,而不是:

$('#RibbonContainer-TabRowRight').prepend('<div style="padding-bottom:3px;background:#fff; color:white!important; float:left; margin-right:20px; line-height:40px;"><a style="padding:0 20px; border:1 green solid;" href="#">Sitemap</a> <a style="padding:0 20px; border:1 green solid;" href="#">Help</a><a style="padding:0 20px; border:1 green solid;" href="#">Welcome!</a></div>');

【问题讨论】:

标签: jquery html sharepoint prepend


【解决方案1】:

只需使用函数 .load()

喜欢这个

$('#RibbonContainer-TabRowRight').load('/_layouts/1033/nav.html');

【讨论】:

    【解决方案2】:
    $.get("../_layouts/1033/nav.html", function(r){
        $("#RibbonContainer-TabRowRight").append(r);
    });
    

    如果需要,这不会替换和执行脚本。

    【讨论】:

      猜你喜欢
      • 2011-03-07
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 2011-09-25
      • 1970-01-01
      • 2014-12-19
      • 1970-01-01
      • 2021-01-26
      相关资源
      最近更新 更多