1

When a search results page is displayed, by default the search input box shows the text searched for. Is there a way to change that so that it is blank by default.

Thanks

2

You can clear the search box using jQuery.

The code below can be added to your results page in a Content Editor Web Part.

<script type="text/javascript">
    $('document').ready(function(){
      $('.s4-searchbox-QueryPrompt').val(""); 
    });
</script>

Note the class name used in the selector $('.s4-searchbox-QueryPrompt') is for SharePoint 2010 and may differ between versions. You can use FireBug or a similar page inspecting tool to find the class.

If you need help adding jQuery to SharePoint, see this article for various ways of doing so.

0

The Search Result Webpart works in a way that it uses url parameters (something like "?k=test" to search for "test". So when you enter "test" into your search input box and hit enter it adds the url parameter.

An input box works in a way that it always shows the url parameter aswell.

So the short answer is: No Long answer: You can't modify the default webpart to do what you're looking for, you would have to replace the search input box by a custom webpart. Possible option: Maybe you could hide the search string using javascript/css, but I'm not sure if you would be able to search for other words after that.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.