Chrome DevTools not showing “checked” or “checked=”true" attribute in html tag
Clash Royale CLAN TAG#URR8PPP
Chrome DevTools not showing “checked” or “checked=”true" attribute in html tag
In the Chrome DevTools, how can you know if a checkbox or radio button is checked. When you click on any of the above, the attribute checked
is not showing at all. It's annoying because I have to guess what's happening and it kind make development process slower. Is there some settings I need to apply?
checked
1 Answer
1
A checkbox has two attributes that talk about it being checked: One is an HTML/DOM attribute, and one is a property of the scripting object. (dom-input-checked and attr-input-checked in the spec, respectively).
The spec sometimes uses the word reflect to indicate that these two kinds of attributes are kept in sync, but it does not in this case: The DOM attribute is the default checked state, and the IDL attribute is the current checked state. This allows to "Reset" a form, for instance.
Example of the attributes being different:
console.log([a.checked, a.getAttribute("checked")]);
a.checked = false;
console.log([a.checked, a.getAttribute("checked")]);
console.log([b.checked, b.getAttribute("checked")]);
b.checked = true;
console.log([b.checked, b.getAttribute("checked")]);
<input type=checkbox id=a checked>
<input type=checkbox id=b>
Anyway, you can use the "Properties" tab in Chrome's devtools to see the other attribute.
(In Firefox this is under Right click > Show DOM Properties, but you have to select the correct iframe first.)
checked
checked="true|false"
Yes, the DOM spec says The className attribute must reflect the "class" content attribute. But since
checked
doesn't, you must go to the properties tab. You can't see something that's not a DOM attribute in the place where DOM attributes are shown.– Josh Lee
Aug 8 at 16:05
checked
So there's really no way at the moment to see a real-time update of
checked
in DevTools. Cool. Thanks for your lesson and help.– Shaoz
Aug 9 at 8:48
checked
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Thanks for the response. But normally whatever happens in the DOM, the devtools usually shows that something is happening, e.g. show/hide with a class, devtools will show that a class is added or removed. I want something similar for when you clicked a checkbox/radio, there should be
checked
orchecked="true|false"
in real-time, right? unless I'm expecting too much from devtools.– Shaoz
Aug 8 at 16:02