jQuery事件实时点击不起作用(jQuery event live click not functioning)

编程入门 行业动态 更新时间:2024-10-13 10:25:21
jQuery事件实时点击不起作用(jQuery event live click not functioning)

我有一个脚本,允许使用Bing API显示搜索结果,例如: JsFiddle

如果输入内容,您将获得两个结果。 var WebOffset允许在Total结果中向上移动结果。 如果通过设置WebOffset=10 ,例如计数为2(就像现在一样),那么在前10个之后将获得两个结果,因此结果为11和12.有了这个,你可以这样做一个分页:

$("li.pageli").live('click', function(){ WebOffset = "Web.Offset=" + $("a", this).html(); var v6 = $('#searchbox').val(); doSearch(v6); });

所以根据li.pageli a的数量,我可以做一个分页。 一切都很好,然后我注意到它不能在IE8中工作。

所以我打算问这个问题。 然而,当我在JsFiddle中设置示例时,我注意到它也在那里工作! 这真的很奇怪,因为完全相同的代码在我的桌面上使用Chrome / Firefox。 那么为什么它不适用于IE8和JsFiddle?

I have a script which allows to display search results with the Bing API, example: JsFiddle

If you type something in, you will get two results. The var WebOffset allows to have results moving up in Total results. If the count for instance is 2 (as it is now) by setting WebOffset=10 you will get two results after the first 10, so result 11 and 12. With this you can do a pagination like this:

$("li.pageli").live('click', function(){ WebOffset = "Web.Offset=" + $("a", this).html(); var v6 = $('#searchbox').val(); doSearch(v6); });

So based on the number of li.pageli a I can do a pagination. All was working well, then I noticed its not working in IE8.

So I was going to ask about this. However when I was setting up the example in JsFiddle I noticed it working there as well! Which is really strange because the exact same code is working for me on my desktop with Chrome/Firefox. So why is it not working in IE8 and JsFiddle?

最满意答案

我发现了问题是什么......

显然'href'应该没有空格......所以这是错误的:

<a href="#"> 20 </a>

这很好:

<a href="#">20</a>

我们都知道IE应该在树林里被淘汰并被枪杀,但我觉得奇怪的是JsFiddle也是这样的。 无论如何案件关闭:)

I found out what the problem is...

Apparently 'href' should be written without spaces....So this is wrong:

<a href="#"> 20 </a>

And this is good:

<a href="#">20</a>

We all know that IE should be taken out in the woods and shot dead, but I find it strange that JsFiddle is also wired that way. Anyway case closed:)

更多推荐

本文发布于:2023-08-04 01:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1405329.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实时   不起作用   事件   jQuery   functioning

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!