Setting up Google Custom Search: https://www.google.com/cse/
I would like to be able to use JS to call the search terms the users are keying.
<script>
(function () {
var cx = 'mygoogle-gcse-id';
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);
})();</script>
How do I use JS to call the elements entered into the search form?
I would want to call:
onblur="somefunction('gsce-input-data')";
The search elements are created on the fly when the code above loads the script. This means you need to attach your listeners using the "live" method, so that they get attached when the element actually enters the DOM:
$('.gsc-input').live('blur', function(e) { //do something });
Here is the fiddle example: http://jsfiddle.net/pASWm/1/