Last active
August 10, 2016 22:28
-
-
Save waynebcox/b3ab86715e825b8fce04d92c5676ce3d to your computer and use it in GitHub Desktop.
Customizing the placeholder text in Google Custom Search input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In Sample Script, the added lines are 11 and 12. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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