title: Hiding/Unhiding SharePoint list/doc library columns
body: <p>I have added some javascript in a content editor to the EditForm.aspx page of a document library. I have the following columns in my document library:</p>
  
  <ul>
  <li>Title</li>
  <li>Description</li>
  </ul>
  
  <p>The javascript hides the "Description" field when when a new item is added, this works great however I then want to the be able to unhide/show the "Description" field if the "Title" has/contains any of the following values when adding a new item:</p>
  
  <p>-TestItem1
  -TestItem2
  -TestItem3</p>
  
  <p>I feel like I am half way there but just not sure how to achieve the unhiding/showing part, the javascript I have so far is listed below:</p>
  
  <pre><code>    &lt;script language="javascript" type="text/javascript"&gt;
  
  &lt;!--
  
  //Custom functionality to hide selected columns from the form
  
  _spBodyOnLoadFunctionNames.push("hideFields");
  
  function findAControl(fieldName){
  
      var arr=document.getElementsByTagName("!");
  
      //get all comments
      for(var i=0; i &lt; arr.length; i++)
      {
          //now match the field name
          if(arr[i].innerHTML.indexOf(fieldName) &gt; 0)
          {
              return arr[i];
  
          }
      }
  }
  
  function hideFields(){
  
  
      var control = findControl("Description");
      control.parentNode.parentNode.style.display="none";
  }
  
  //end custom functionality--&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>Thanks</p>