다음을 통해 공유


Change text in SharePoint 2013 search box

SharePoint adds a search box by default to all site pages created OOB. This text reads as 'Search...' or 'Search This Site' but sometimes you might prefer to customize this text. EG, you might want it to be 'Search This Site'.

This can be done easily in a few steps using jQuery.

1.) Navigate to a page where you want to change the text.

2.) Click on the gear icon, top right corner, and select 'Edit Page'.

3.) Click on 'Add a Web part' and select 'Content Editor Webpart' under 'Media and Content' category.

4.) Click on 'Click here to add new content' and select 'Insert' tab from ribbon. Click on 'Embed Code' to add JavaScript code (see below screenshot).

5.) Copy below code to change the text.

01.<script src="https://code.jquery.com/jquery-1.11.3.min.js>" type="text/javascript"></script>
02.<script type="text/javascript">
03.$(document).ready(function(){
04.      var val = $('.ms-helperText').val();
05.         if (val === "Search..." || val === "Search this site") {
06.                $('.ms-helperText').val("Search My Site");
07.         } 
08.});
09.</script>

This is how it will look.

Hope this helps.