ampproject / ampproject/amphtml
Radio button checked not recognised
Open
Component: amp-script
P3: When Possible
Stale
Type: Bug
WG: components
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to check in AMP if radio inputs are checked, but they always return undefined.
This is the html:
And this is the content of the external js file:
const button = document.getElementById('send-button');
const radioSelectedValue = document.querySelector('input[name="some-name"]');
button.addEventListener('click', () => {
console.log(radioSelectedValue.checked);
});
The console.log shows undefined.
Contributor guide
Assessment
This issue has not been assessed yet.