Reputation: 9429
SharePoint is a beast and seems to stomp on everything. Customizing the front-end with javascript has gone well, but now I would like to provide my content owners with more back-end controls. However, any changes made to objects in the WYSIWYG editable area at $(document).ready are immediately reverted by SharePoint.
I imagine this has to do with that "content" not really existing there, but being a copy of hidden input fields. Does anyone know how to get some control of this area? I would love to be able to insert or modify "page content" under the control of scripts, but SharePoint documentation is so terrifyingly sparse.
*EDIT: It appears as though content which is inserted "late" (as in html which is inserted by a click event well after page load) will stick. Anything done at doc.ready or window.load however is rinsed before the area is relinquished to user control.
Upvotes: 0
Views: 594
Reputation: 180874
Sharepoint does a lot of "Sanitizing" of Content entered into some HTML Fields or Content Editor Web Parts sadly. Can you edit the Master Page through SharePoint designer and stick your JavaScript in there?
Also look at ExecuteOrDelayUntilScriptLoaded or _spBodyOnLoadFunctionNames.push()
Upvotes: 1