Thursday, May 1, 2014

Update Search Watermark SharePoint 2013

Assumption
- Publishing Site
- Update Watermark to Search Google
- Search control is on the page with same selector as below. If not, update it with appropriate selector and verify via rule selector of FF or equivalent.

var theSearchBox = $('div#SearchBox .ms-srch-sb input');
    var defaultSearchText = "Search this site";
    var preferredSearchText = "Search Google";
    theSearchBox.val(preferredSearchText);

    theSearchBox.focus(function () {
        if ($(this).val().indexOf(preferredSearchText) === 0) {
            $(this).val('');
        }
    });

    theSearchBox.blur(function () {
        if ($(this).val().indexOf(defaultSearchText) > -1)
            $(this).val(preferredSearchText);
    });



No comments:

Post a Comment