单选按钮更改事件不适用于Chrome或Safari浏览器 [英] Radio Button change event not working in chrome or safari

查看:173
本文介绍了单选按钮更改事件不适用于Chrome或Safari浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面上有一些单选按钮,当选择是时,其他控件(下拉框和文本框)变得可见。如果选择否,则它们会再次变得不可见。这在FF& IE浏览器。当我用chrome使用鼠标时它确实有效,但是当我浏览页面时,控件永远不可见。这就好像改变事件不会触发,因为我是tab键。任何想法可能会导致这种情况,或者我怎么去解决它?



显示/隐藏功能正在使用JQuery完成。



编辑:显示出现问题的代码。

  $(#rbtnControlYes)。change(function(){$(#otherControls)。show();}); 


解决方案

找到这个答案。



而不是使用.change事件,我将它切换到.click并且一切正常。



希望这可以帮助某人。 / p>

拍子


I've got some radio buttons on a page and when Yes is selected, some other controls (dropdowns and textboxes) become visible. If No is selected, they become invisible again. This is working fine in FF & IE. It does work when I use the mouse with chrome, but when I'm tabbing through the page, the controls never become visible. It's as if the change event doesn't trigger because I'm tabbing. Any ideas of what might be causing this, or how I'd go about fixing it?

The show/hide functionality is being done with JQuery.

Edit: Showing the code that is giving problems.

$("#rbtnControlYes").change(function () { $("#otherControls").show(); });

解决方案

Found the answer to this.

Instead of using the .change event, I switched it to .click and everything worked fine.

Hope this helps someone.

Slap

这篇关于单选按钮更改事件不适用于Chrome或Safari浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆