mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #12707 from calixteman/radio_check
Checkboxes with the same name must behave like a radio buttons group
This commit is contained in:
commit
f48cfba945
1 changed files with 10 additions and 0 deletions
|
@ -717,6 +717,16 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
}
|
||||
|
||||
element.addEventListener("change", function (event) {
|
||||
const name = event.target.name;
|
||||
for (const checkbox of document.getElementsByName(name)) {
|
||||
if (checkbox !== event.target) {
|
||||
checkbox.checked = false;
|
||||
storage.setValue(
|
||||
checkbox.parentNode.getAttribute("data-annotation-id"),
|
||||
{ value: false }
|
||||
);
|
||||
}
|
||||
}
|
||||
storage.setValue(id, { value: event.target.checked });
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue