0

Good day,

I would like to change “search this site” text for my SharePoint Search field to "Search...". I open my master page and add the script

        <script type="text/javascript">//<![CDATA[                

          $(document).ready(function()
            {        

        $('input.ms-helperText').attr('value', "Search... ");
        $('input.ms-helperText').attr('title', "Search... ");
        $('input.ms-helperText').click(function() { 
        $('input.ms-helperText').attr('value', "");
            });




        //]]>
        </script>

It works fine for Google Chrome and Firefox, but it doesn't work for IE. Even for IE11. I can't understand, why.

This solution didn't help too https://radhikakasetty.wordpress.com/2011/09/12/change-the-search-this-site-text-of-the-search-box-sharepoint-2010/

I would be grateful for any info.

1 Answer 1

0

Per my test, your script doesn't work in Chrome. F12(developer tools) console shows this error:

enter image description here

You need to add }); in the end of your code:

<script type="text/javascript">//<![CDATA[                

          $(document).ready(function()
            {        

        $('input.ms-helperText').attr('value', "Search... ");
        $('input.ms-helperText').attr('title', "Search... ");
        $('input.ms-helperText').click(function() { 
        $('input.ms-helperText').attr('value', "");
            });



        });
        //]]>
        </script>
8
  • Thanks for reply, I didn't forget about }); on my master page. I forgot to add them here. Script didn't work in IE.
    – Anonymous
    Jun 8, 2020 at 11:41
  • When I view Site Page in IE, I see the js, which defined “search this site” text for my SharePoint Search field. This Script
    – Anonymous
    Jun 8, 2020 at 15:10
  • ExecuteOrDelayUntilScriptLoaded( function() { if ($isNull($find('ctl00_PlaceHolderSearchArea_SmallSearchInputBox1_csr'))) { var sb = $create(Srch.SearchBox, {"delayLoadTemplateScripts":true,"initialPrompt":"SEARCH THIS SITE","messages":[],"navigationNodes": ~sitecollection/_catalogs/masterpage/Display Templates/Search/Control_SearchBox_Compact.js"...)); } }
    – Anonymous
    Jun 8, 2020 at 15:12
  • I tried to change Control_SearchBox_Compact and Control_SearchBox like here? but it didn't help sharepoint.stackexchange.com/questions/126241/…
    – Anonymous
    Jun 8, 2020 at 15:17
  • I can't find the link to the script which set "SEARCH THIS SITE" text on master page...
    – Anonymous
    Jun 8, 2020 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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