HTMLInputElement .type that (checkbox, radio) 's default value is "on"
Reported by
johnny.s...@gmail.com,
Oct 21
|
|||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Steps to reproduce the problem:
1. document.createElement("input"); and
it.setAttribute("radio") or "checkbox"
2. get on created element.value
3. you can get string about "on"
sample:
const ck = document.createElement("input");
ck.type = "radio";
console.log(ck.value);
What is the expected behavior?
If there value doesn't setting it then get "" or null or undefined
What went wrong?
HTMLInputElement .type that (checkbox, radio) 's default value is "on"
Did this work before? No
Chrome version: 69.0.3497.100 Channel: stable
OS Version: 10.0
Flash Version:
m(_ _)m
,
Oct 23
Thanks for filing the issue! @Reporter: Could you please share a sample test file with the conditions mentioned in comment#0, which helps us to triage the issue further in a better way.
,
Oct 24
The standard defines this behavior, and other browsers have the same behavior. https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default-on > default/on > On getting, if the element has a value content attribute, return that attribute's value; otherwise, return the string "on". What you want might be ck.checked, not ck.value
,
Oct 25
I'm sorry for this issue Thank you so much and good regards. |
|||
►
Sign in to add a comment |
|||
Comment 1 by phanindra.mandapaka@chromium.org
, Oct 21