Skip to content

Instantly share code, notes, and snippets.

@waynebcox
Last active August 10, 2016 22:28
Show Gist options
  • Save waynebcox/b3ab86715e825b8fce04d92c5676ce3d to your computer and use it in GitHub Desktop.
Save waynebcox/b3ab86715e825b8fce04d92c5676ce3d to your computer and use it in GitHub Desktop.
Customizing the placeholder text in Google Custom Search input
In Sample Script, the added lines are 11 and 12.
<script>
(function() {
var cx = '008259309430927337174:3jjrzypsqka';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
window.onload = function(){
document.getElementById('gsc-i-id1').placeholder = 'Search this website ...';
};
</script>
<gcse:search></gcse:search>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment