Currently the page only works for the first list item. I want the onclick show/hide to work for all list elements. I tried changing it to get element by class, yag name, but couldn't get it right.
Here is the code:
HTML
<ul>
  <li id="virsraksts" class="slid">
    <h3>{{ post.date | date: "%B %d, %Y" }}: {{ post.title }}</h3>
  </li>
  <div id="kontents" class="storijs">
    <div style="height:20px;"></div>
    {{ post.content }}
    <div style="height:20px;"></div>
  </div>
  <li id="virsraksts" class="slid">
    <h3>{{ post.date | date: "%B %d, %Y" }}: {{ post.title }}</h3>
  </li>
  <div id="kontents" class="storijs">
    <div style="height:20px;"></div>
    {{ post.content }}
    <div style="height:20px;"></div>
  </div>
  <li id="virsraksts" class="slid">
    <h3>{{ post.date | date: "%B %d, %Y" }}: {{ post.title }}</h3>
  </li>
  <div id="kontents" class="storijs">
    <div style="height:20px;"></div>
    {{ post.content }}
    <div style="height:20px;"></div>
  </div>
</ul>
CSS
.storijs {
    display: none;
}
.para {
    display: block;
}
JS
document.getElementById("virsraksts").onclick = function() {
  myFunction()
};
function myFunction() {
  document.getElementById("kontents").classList.toggle("para");
}
 
    