Im using Google custom search and I would like to submit its form using my own div with Jquery. I tried many things with no luck, this is one of them:
The Google code:
<script>
(function() {
var cx = 'partner-pub-2789521296837340:9402765321';
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>
<gcse:search></gcse:search>
The Jquery part:
$( document ).ready(function() {
$( "div.button" ).click(function() {
$( "form.gsc-search-box" ).submit();
return false;
});
});
Live example: JsFiddle