【发布时间】:2016-05-05 09:27:44
【问题描述】:
我正在使用谷歌自定义搜索 api,但我不想要谷歌搜索默认文本框,所以为了同样的原因,我创建了一个新的文本框和一个按钮。单击我的自定义按钮时,我将从我的自定义文本框中获取搜索键值并将其放入谷歌搜索默认文本框中。但在我的 javascript 函数中,我无法执行谷歌搜索提交按钮的点击事件。我现在知道 google 搜索提交按钮的类名,如何在我的 java 脚本函数中执行点击事件?
google search dubmit 按钮类名是“gsc-search-button gsc-search-button-v2”
现在在下面的方法中我需要执行上述类的点击事件。
<script>
function myFunction() {
document.getElementById('gsc-i-id1').value = document.getElementById('customTextBox').value;
// here I need to perform click event for "gsc-search-button gsc-search-button-v2" class
}
</script>script>
我在以下链接中有演示示例,
http://jsfiddle.net/3L4fd63g/3/
大家有什么建议
【问题讨论】:
标签: javascript jquery html google-search google-custom-search