Skip to Content

mobileSearchPlaceholder()

Change the search input placeholder from “What are you looking for?” to just “Search” for narrow viewports (mobile).

JavaScript February 22, 2017

Usage

This function runs automatically, so it is not called manually. Is this incorrect?

Additional Notes

This function triggers the change at 410px wide viewport.

Source File

Located in /assets/js/nebula.js on line 2233.

Note: This function contains 1 to-do comment.

JavaScript
nebula.mobileSearchPlaceholder = function(){
    var mobileHeaderSearchInput = jQuery('#mobileheadersearch input');
    var searchPlaceholder = 'What are you looking for?';
    if ( window.matchMedia && window.matchMedia("(max-width: 410px)").matches ){ //@todo "Nebula" 0: Use optional chaining?
        searchPlaceholder = 'Search';
    }
    mobileHeaderSearchInput.attr('placeholder', searchPlaceholder);
};

Override

To override or disable this JavaScript function, simply redeclare it with the exact same function name.

JavaScript
nebula.mobileSearchPlaceholder = function(){
    //Write your own code here, leave it blank, or return false.
}