0

I really need to get rid of the web part zone on the right. SharePoint Designer is not an option right now so I am requesting anything other than that, please. I have seen this JavaScript "hack" multiple times now when looking for the solution:

<script>

function HideWebPartZone()
{
  var x = document.getElementsByTagName("TD")
  var i=0;
  for (i=0;i<x.length;i++)
  {
    if (x[i].width=="70%")
    {
      // left column
      x[i].style.width="100%"; 

      // center (otherwise empty) column
      if (document.all) // is IE
        var x2=x[i].nextSibling;
      else
        var x2=x[i].nextSibling.nextSibling;

      x2.style.width="0";
      x2.style.display="none";
      x2.innerHTML=""; 

      // right column
      if (document.all) // is IE
        x2=x[i].nextSibling.nextSibling;
      else
        x2=x[i].nextSibling.nextSibling.nextSibling.nextSibling;

      x2.style.width="0";
      x2.style.display="none";
      x2.innerHTML=""; 

      // right margin column
      if (document.all) // is IE
        x2=x[i].nextSibling.nextSibling.nextSibling;
      else
        x2=x[i].nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling;

      x2.style.width="0";
      x2.style.display="none";
      x2.innerHTML="";

      //all done
      return;
    }
  }
}

This code works marvelously when testing the results on IE 11, very good job to whoever wrote it. BUT, it does not work when viewing in Chrome, which is a problem. Does anybody else see the same problem when trying out between the two browsers? Any suggestions or help?? Please and thank you!

  • have you trided using the browser dev tools to isolate a selector and then using css to set the display to none? – Eric Alexander Jul 2 '14 at 18:54
  • @PirateEric No, I'm not sure how to do that... but then again, I'm not sure that would make the changes for every user that visits the page, would it? – natlotzy Jul 2 '14 at 19:08
  • Yes, it would be for every user. This seems like overkill for hiding something. Just press F12, select the element you want hidden, and get the ID. Then using jQuery: $("#RightZone").hide(); – Colbs Jul 2 '14 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.