Quicknote: Hiding "Narrow The Search" from advanced search

I had to hide the “narrow the search” box from the advanced search, due to it only containing one field. I could not do this via the standard webpart properties, due to needing to see specific criteria below. To do this, I wrote a (pretty horrible) bit of JS, and added it to a content editor webpart with no chrome below the advance search webpart
<script language=”javascript”>
var arr = document.getElementsByTagName(“h3″);
for (i = 0; i < arr.length; i++)
{
   if (arr[i].className == ‘ms-standardheader’ && arr[i].innerText == ‘Narrow the search…’)
   {
var parentRow = arr[i].parentNode.parentNode;
        // Hide this row and next three rows
        parentRow.style.display = ‘none';
        parentRow.nextSibling.style.display = ‘none';
        parentRow.nextSibling.nextSibling.style.display = ‘none';
        parentRow.nextSibling.nextSibling.nextSibling.style.display = ‘none';
   }
}
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>