ampproject / ampproject/amphtml

Radio button checked not recognised

Open
#38,166 2 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.