I'm using the following code -

```
<script>var element = document.getElementById("more");
element.classList.add("wide");</script>

```

It is used in a php if statement. If a post in wordpress has a particular custom field completed it applies the class .wide to the post button which has an id of #more.

The problem is that if there are more than one instance of the id #more on the page (as there is in my excerpt pages) it only targets the first instance of #more and not the remaining post buttons on the page.

Is there a way to alter the above code so it targets ALL ids of "more" or any other way I can label the buttons I want targeted and change the code to target them all?