I have a list for events in which I have placed content editor web part in "NewForm.aspx", "EditForm.aspx" and "DispForm.aspx". to hide recurrence field using JavaScript
The field is hidden successfully using JavaScript but when I click on the event and click on View Event from ribbon the following error occurs:
The "ListFormWebPart" Web Part appears to be causing a problem
The JavaScript code in the above mentioned forms is as below:
<script type="text/javascript">
var TDs = document.getElementsByTagName("TD");
var i=0;
var tagContent = "";
while (i < TDs.length)
{
try
{
tagContent = TDs[i].innerText || TDs[i].textContent;
if (tagContent.indexOf("Recurrence") == 0 || tagContent.indexOf("Recurrence") == 3)
{
TDs[i+1].parentNode.removeChild(TDs[i+1]);
TDs[i].parentNode.removeChild(TDs[i]);
}
}
catch(err){}
i=i+1;
}
</script>
One more thing I would like to clear is, when I manually go to the list's form it redirects me to the page, i.e. when I type URL of display form the page is redirected successfully.
What am I missing?