I want to keep it short.
Im trying to create a SharePoint template for WikiPages. In the EditMode the user or creator of a WikiPage should have the possibilities to fill out RichHTMLFields which are placed in a table. When he needs a new table row, he can click on a button to add one.
My idea is to define a table with 20 rows. 19 of them should get been hidden by a jQuery function when the user created a new WikiPage. Every time he clicks on a button, a new row shows up. I have to do it this way, because every PlaceHolder, in my case a RichHTMLField has a unique ID, which already has to be available after creating a new page.
I uploaded the jQuery library to /~SiteCollection/Scripts/jquery.js
. Then I linked my library to the v4.master masterpage:
<SharePoint:ScriptLink runat="server" name="~Sitecollection/Scripts/jquery.js" language="javascript" />
I added this just above the PageHolderAdditionalPageHead
part in the masterpage.
Before that I've also tried linking the library to my template, with the code line:
<script src="~Sitecollection/Scripts/jquery.js" type="text/javascript"></script>
But none of both varieties work.
The code for my table looks like this:
<tr class='hideRows'>
<td style="border-style:solid; border-width:2px; border-color:silver;">
<div data-name="Page Field: Content 2">
<!--CS: Start Page Field: Content 2 Snippet-->
<!--SPM:<%@Register Tagprefix="PageFieldRichHtmlField" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
<!--MS:<PageFieldRichHtmlField:RichHtmlField FieldName="9d213306-7486-4cd4-916c-0a95155a594a" runat="server">--><!--PS: Start of READ-ONLY PREVIEW (do not modify)--><div id="ctl02_label" style="display:none">Content 2</div><div id="ctl02__ControlWrapper_RichHtmlField" class="ms-rtestate-field" style="display:inline" aria-labelledby="ctl02_label"><div align="left" class="ms-formfieldcontainer"><div class="ms-formfieldlabelcontainer" nowrap="nowrap"><span class="ms-formfieldlabel" nowrap="nowrap">Content 2</span></div><div class="ms-formfieldvaluecontainer"><div class="ms-rtestate-field">Content 2 field value. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div></div></div></div><!--PE: End of READ-ONLY PREVIEW-->
<!--ME:</PageFieldRichHtmlField:RichHtmlField>-->
<!--CE: End Page Field: Content 2 Snippet-->
</div>
</td>
</tr>
Followed by the jQuery function:
<script type="text/javascript">
$(document).ready(function(){
$('.hideRows').hide();
});
</script>
after the end of the table </table>
I've tried putting this code above the PlaceHolderAdditionalPageHead
as well. But it doesn't work either...
I hope someone can help me out here.
Thanks in advance!
Cheers
Stefan
/_catalogs/masterpage/jquery.js
and linked it equally. But this didn't work either.<script type="text/javascript" src= "<asp:Literal runat='server' Text='<%$SPUrl:~sitecollection/Script%20Library/jquery-1.4.2.min.js%>'/>"></script></span>
<script>
-link, I get anSomething went wrong
error. I corrected the path, of course. @Leopold: I've seen this folder_layouts/15/
before, in the preview window or the snippet page in the address bar but I can't locate it in the SP designer. I also tried using absolute paths now, tried with different locations and paths (varieties). Still doesn't work. @Patrick: I put my jQuery link at the bo<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
. Also check this: sharepoint.stackexchange.com/questions/17308/…