Google Custom Search with autosuggest

by fredd man

HTML

<!-- Try switching the attribute value to "true" or "false" -->
<gcse:search enableAutoComplete="true"></gcse:search>

JavaScript

// Make sure in jsFiddle you have selected option onLoad
(function() {
  var cx = '017643444788069204610:4gvhea_mvga'; // Insert your own Custom Search engine ID here
  var gcse = document.createElement('script');
  gcse.type = 'text/javascript';
  gcse.async = true;
  gcse.src = (document.location.protocol == 'https' ? 'https:' : 'http:') +
    '//www.google.com/cse/cse.js?cx=' + cx;
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(gcse, s);
})();