ampproject / ampproject/amphtml

store values of selected checkboxes in array in google AMP

Open
#38,498 1 comment 0 reactions 0 assignees View on GitHub
P3: When Possible Stale Type: Bug
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

I want to have an array as state and I want to store values selected checkboxes in that state ... how can I achieve this? Also why e.target.checked is always false even if I select it ?

```


{
"animals": []
}


cat

dog

const cat = document.getElementById('cat')
cat.addEventListener('change',e=>{
console.log(e.target.checked) //this is always false ... buy why ??
})
//how to store values of selected checkboxes in checkbox.animales state ??

```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the inline AMP example and observing the checkbox change event. Then inspect AMP Script event and state-handling behavior; done means the example reports the selected state correctly and stores selected values in checkbox.animals.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.