ampproject / ampproject/amphtml

Not able to access the elements inside the amp tags by using document.getElementById or document.getElementsByClassName

Open
#35,962 2 comments 0 reactions 0 assignees View on GitHub
Stale Type: Bug
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

Not able to select the element inside the amp tags like amp-selector,amp-carousel by using the document.getElementById or document.getElementsByClassName. Always gets the null or empty array.
snippet

### Reproduction Steps

In code i am trying to access the select option. I want to make the city dropdown option selected based on the city user is in. I am getting null or empty array.

### Relevant Logs

_No response_

### Browser(s) Affected

_No response_

### OS(s) Affected

_No response_

### Device(s) Affected

_No response_

### AMP Version Affected

_No response_

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.