Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/forms/the-input-element/radio-form-owner.html - WPT Dashboard Interop Dashboard
<!doctype html>
<meta charset="utf-8" />
<title>Adding checked radio button to a form updates radio buttons in same group</title>
<link rel="author" title="Glenn Skrzypczak" href="mailto:glenn.skrzypczak@gmail.com"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<form id="form">
<input type="radio" name="group" id="radio1" checked />
</form>
<input type="radio" name="group" id="radio2" checked />
<script>
let radio1 = document.getElementById("radio1");
let radio2 = document.getElementById("radio2");
test(function () {
assert_true(radio1.checked);
assert_true(radio2.checked);
radio2.setAttribute("form", "form");
assert_false(radio1.checked);
assert_true(radio2.checked);
}, "Adding checked radio button to a form updates radio buttons in same group");
</script>