2017-03-26 57 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