Sharepoint 2013 Jscript/jquery仅在编辑器(CEWP)中起作用,而在发布时不起作用 [英] Sharepoint 2013 Jscript/jquery only works in Editor (CEWP) and not in when published
问题描述
我已经搜索了博客,却找不到解决此常见问题的解决方案:
我试图在Sharepoint 2013中使用jquery运行一个非常简单的脚本,但它似乎只能在编辑器中工作
请参见下面的代码:
<脚本语言="javascript" type ="text/javascript" src =" http:.../SiteAssets/jquery-3.2.1.min.js"></script>
< script language =" javascript" type ="text/javascript" src ="http:.../SiteAssets/sputility.min.js"</script>
< script language ="javascript" type ="text/javascript">
//等待窗口加载
$(document).ready(function(){
//示例:将标题"字段的值设置为"Hello world"!
SPUtility.GetSPField('Title').SetValue('Hello world2!');
});
</script>
注意:我也研究了MDS
Matrix,您必须使用代码编辑器或指向站点代码中的JS文件. /blockquote>
I have search the blogs and cannot find a solution to this very common problem:
I am trying to run a very simple script using jquery in Sharepoint 2013 but it only seems to work in the editor
see code below :
<script language="javascript" type="text/javascript" src="http:......./SiteAssets/jquery-3.2.1.min.js"></script>
<script language="javascript" type="text/javascript" src="http:......./SiteAssets/sputility.min.js"></script>
<script language="javascript" type="text/javascript">// wait for the window to load
$(document).ready(function () {
// EXAMPLE: Set the value of the Title field to Hello world!
SPUtility.GetSPField('Title').SetValue('Hello world2!');
});
</script>Note : I have also looked into MDS
解决方案Hi Matrix- you have to either use a code editor or point to a/the JS file in the site code.
这篇关于Sharepoint 2013 Jscript/jquery仅在编辑器(CEWP)中起作用,而在发布时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!