【问题标题】:How to create Hyperlink for SharePoint List Form如何为 SharePoint 列表表单创建超链接
【发布时间】:2017-08-19 05:18:37
【问题描述】:

我对编码很陌生,我的任务是在我的工作中更新 SharePoint 表单,这个任务看起来很简单,但我做不到。

我需要将下面当前代码中的“鱼骨图”一词转换为将显示在 SharePoint 列表表单上的超链接。

这是当前代码:

$('input[id^="Primary_x0020_Root_x0020_Cause_x_"').parent().parent().parent().before("<tr> <td class='primaryrootcause' colspan='2'>Primary Root Causes - List root causes (use the Fishbone Diagram or 5 Whys tool to help you determine the root cause)</td></br></tr>");

【问题讨论】:

    标签: javascript html list sharepoint hyperlink


    【解决方案1】:

    根据经验,我知道像这样处理 SharePoint 表单自定义并不理想,但如果您打算保留这种方法,则只需在上面的 JS 中转义引号字符即可创建嵌套的 HTML 元素。

    完整的解决方案是这样的:

    $('input[id^="Primary_x0020_Root_x0020_Cause_x_"').parent().parent().parent().before("<tr> <td class='primaryrootcause' colspan='2'><a href=\'https://www.google.com/search?q=fishbone+diagram\' target=\'_blank\'>Primary Root Causes</a> - List root causes (use the Fishbone Diagram or 5 Whys tool to help you determine the root cause)</td></br></tr>");
    

    具体来说,字符串的原始部分:

    (use the Fishbone Diagram...

    变成……

    (use the &lt;a href=\'https://www.google.com/search?q=fishbone+diagram\' target=\'_blank\'&gt;Fishbone Diagram&lt;/a&gt;

    注意使用\' 作为转义引号字符来包装&lt;a&gt; 标记的hreftarget 属性值。

    我还在这里组装了一个可用的 CodePen: http://codepen.io/anon/pen/MpBZbJ

    【讨论】:

    • 这很完美!非常感谢您的帮助!
    • 当然是 SWynne - 我还调整了示例以专门显示“鱼骨图”文本上的超链接
    • 太棒了!我很感激帮助。真的救了我的后腿。
    • 没问题 - 如果确实有帮助,请将答案标记为“已接受”
    猜你喜欢
    • 2019-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-15
    • 2019-12-30
    • 1970-01-01
    • 2018-10-18
    • 1970-01-01
    相关资源
    最近更新 更多