检查= QUOT;检查"不在铬工作 [英] checked="checked" not working in chrome

查看:95
本文介绍了检查= QUOT;检查"不在铬工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < input type =checkboxname =Type []value =Redchecked =checked/>< span class =space-right >红色< /跨度> 

正确设置复选框以在Firefox和safari中签入,但不是Chrome。无法找到任何有关此信息。



任何人都知道如何解决这个问题?



裸体已检查以及已检查=true



不寻找js解决方案,谢谢。



编辑:下面taco的回答描述了问题所在。使用表单和输入元素时,元素必须正确嵌套在< td>< / td> 标签中或 checked =checked 不起作用。下面是一个jsfiddle的例子,它证明了这一点在chrome 29.0.1547.57上是正确的: http://jsfiddle.net/LnL7b/

解决方案

我可以在Google Chrome 28.0.1500.95版本上复制此问题。

 < table> 
< tr>
< td>测试< / td>
< input type =radioname =foovalue =barchecked =checked>
< / tr>
< / table>

我通过错误地嵌套单选按钮来破坏表格。这会以某种方式导致Google Chrome无法将输入收音机标记为已选中状态。

jsfiddle示例 - 破碎
jsfiddle示例 - 工作


<input type="checkbox" name="Type[]" value="Red" checked="checked" /><span class="space-right">Red</span>

Properly sets checkbox to checked in firefox and safari but not chrome. Can't find any info about this online.

Anyone know how to fix this?

Have also tried the naked checked as well as checked="true"

Not looking for a js solution, thank you.

Edit: The answer by taco below describes what the issue was. When using forms and input elements, the elements must be properly nested in <td></td> tags or the checked="checked" has no effect. Here is an example of a jsfiddle that proves this to be true on chrome 29.0.1547.57: http://jsfiddle.net/LnL7b/

解决方案

I was able to replicate this issue on Google Chrome Version 28.0.1500.95.

<table>
  <tr>
    <td>test</td>
    <input type="radio" name="foo" value="bar" checked="checked">
  </tr>
</table>

I broke the table by improperly nesting a radio button. This somehow causes Google Chrome to not mark the input radio as checked.

jsfiddle example - broken and jsfiddle example - working

这篇关于检查= QUOT;检查&QUOT;不在铬工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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