自定义搜索引擎按钮单击 [英] Custom search engine Button click
本文介绍了自定义搜索引擎按钮单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在自定义搜索引擎搜索按钮上调用函数。
Im trying to call function on Custom Search Engine search button click.
我尝试的代码是:
<script type="text/javascript">
$(".gsc-search-button input[type=button]").click(function()
{
alert("1");
});
</script>
无效。
网站: a href =http://akcijos.igloro.info/?q=Android =nofollow> http://akcijos.igloro.info/?q=Android
Site: http://akcijos.igloro.info/?q=Android
编辑:
找到解决方案:将点击事件绑定到Google自定义搜索中的搜索按钮
推荐答案
原因:
解决方案
在window.onload之后使用google js api创建搜索框,因此.bind()失败。解决了jquery.live()的问题。
The search box is created with google js api after window.onload, therefore the .bind() fails. Solved the problem with jquery.live().
代码:
<script type="text/javascript">
$("input.gsc-search-button[type=submit]").live('click', function()
{
console.log("clicked");
alert("1");
});
</script>
Other post url: Bind click event to 'search' button in Google Custom Search
这篇关于自定义搜索引擎按钮单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文