【问题标题】:checked="checked" not rendering as checked radio button in Chromechecked="checked" 在 Chrome 中未呈现为选中的单选按钮
【发布时间】:2018-05-10 22:01:44
【问题描述】:

如果我在 doc.ready 之后通过 js 插入一些 html,而不是 check='checked' 单选按钮在 Google Chrome 中不会呈现为选中状态

另外,我注意到如果我从输入中删除 name 属性,它就会起作用

这就是全部内容:

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"
type="text/javascript"></script>
</head>
<body>

<script type='text/javascript'>
$(function(){
$('body').append('<input type="radio" checked="checked" value="33" name="whatever" id="aeHobby0">');

});
</script>
</body>
</html>

【问题讨论】:

    标签: javascript html google-chrome


    【解决方案1】:

    这似乎是 1.4.4 (live copy) 中的一个错误。它在 1.6.2 (live copy) 中运行良好。看起来它已在 1.5.2 和 1.6.0 之间修复(至少在我的测试中),这表明它可能已被修复错误 80608500 的补丁修复。

    【讨论】:

    • @贾斯汀:1.6.0 seems to work。但是还有 other very good reasons 远离 1.6.0。 ;-)
    • 帮助?截至 2012 年 8 月 13 日,我正在运行最新的 chrome 21.0.1180.75 m,问题似乎又回来了。有什么解决方法的建议吗?
    • @stu:我正在运行相同版本的 Chrome。奇怪的是,both 答案中的链接对我来说都可以正常工作,就像使用 jQuery 1.7.2 一样。可能是完全不同的问题。
    猜你喜欢
    • 2013-07-24
    • 1970-01-01
    • 2013-10-01
    • 1970-01-01
    • 2018-08-24
    • 1970-01-01
    • 2018-08-21
    • 2017-11-17
    • 2016-09-27
    相关资源
    最近更新 更多