【发布时间】:2011-07-30 10:59:04
【问题描述】:
我正在尝试自定义两列 Google 自定义搜索。我真的很喜欢 iframe 上的 ajax,它填充了一个 div(默认 div#cse)。但问题是它会推动其他内容破坏页面。所以我想在单击“搜索”按钮时隐藏 div#content 中的内容,并在单击“重置按钮”时再次显示。为此,我尝试将单击事件处理程序绑定到提交按钮,但没有成功。
$(document).ready(function(){
$("input.gsc-search-button[type=submit]").click(function(){
alert("worked");
//hide div#content
})
})
然后我尝试以下检查它是否绑定了事件。虽然它不是我想要的。 google api 不提供任何此类回调。
<input id="click" type="button" value="bind event"/>
$(document).ready(function(){
$("#click").bind('click', function(){
$("input.gsc-search-button[type=submit]").bind('click', function(){
alert("worked");
//hide div#content
})
})
})
有什么办法可以做到吗?
谢谢。
【问题讨论】:
标签: javascript jquery google-search google-search-api