2017-03-26 55 views
0

我对编码非常陌生,并且被委托在我的工作中更新SharePoint窗体,任务看起来很简单,但我无法做到。如何为SharePoint列表表单创建超链接

我需要在当前代码中将“Fishbone Diagram”一词放入超链接,该超链接将显示在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>"); 

回答

0

我从经验中知道,处理与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 <a href=\'https://www.google.com/search?q=fishbone+diagram\' target=\'_blank\'>Fishbone Diagram</a>

请注意使用\'作为转义的引号字符,用于包装<a>标记的hreftarget属性值。

我还组建了一个工作CodePen这里: http://codepen.io/anon/pen/MpBZbJ

+0

这完美地工作!非常感谢你的帮助! – SWynne

+0

当然SWynne - 我也调整了示例以显示'Fishbone Diagram'文本上的超链接 – Stevangelista

+0

太棒了!我很感激帮助。真的救了我的背后。 – SWynne