更改处理程序未在Firefox上的无线电输入上调用 [英] Change handler not called on radio input on Firefox

查看:134
本文介绍了更改处理程序未在Firefox上的无线电输入上调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我把这个问题归结为这个jsfiddle: http://jsfiddle.net/shaggyfrog/ DUQYW / 3 /



在Chrome / Mac和Safari / Mac上,每次(重新)加载页面时都应该看到foo

在Firefox / Mac上,foo提醒只会在第一时间出现。后续重新加载不会触发它。

这是:(A)Firefox上的jQuery中的一个错误,无线电输入上的更改处理程序应该被调用,而不管它检查状态; (二)一个不同的jQuery错误,其中更改处理程序不应该被调用,如果它已经被检查;或者(C)我做了一些愚蠢的事情。



这是一个合法的错误还是我的合法的n00b?


I've distilled the issue down to this jsfiddle: http://jsfiddle.net/shaggyfrog/DUqYW/3/

On Chrome/Mac and Safari/Mac, you should get the "foo" alert every time you (re)load the page.

On Firefox/Mac, the "foo" alert only comes up the first time. Subsequent reloads do not trigger it.

This is either: (A) a bug in jQuery on Firefox, where a change handler on a radio input should get called irrespective of its state when it's checked; (B) a different jQuery bug, where the change handler should not be called if it's already checked; or (C) me doing something stupid.

Is this a legitimate bug or am I a legitimate n00b?

解决方案

When you reload, Firefox preserves the checked state of radios from before the reload, so your script clicks an input that is already checked... and hence there is no value change.

这篇关于更改处理程序未在Firefox上的无线电输入上调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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