title: How to Get Element By Class in JavaScript and change aria-checked="false" to "true"?
body: <p>I am trying to select multiple classes on a page and change the <code>aria-checked="false"</code> to <code>aria-checked="true"</code>. Here is the script I am using now:</p>
  
  <pre><code>elms=document.getElementsByClassName("d-va-p a-f-e");
  for (i=0;i&lt;elms.length;i++){
      if(elms[i].getAttribute("aria-checked")="false")
          elms[i].getAttribute("aria-checked")="true"
  };
  </code></pre>
  
  <p>The source code is below. The class is "d-va-p a-f-e".</p>
  
  <pre><code>&lt;div class="d-va-p a-f-e" style="-webkit-user-select: none;" role="option" tabindex="-1" aria-checked="false" id=":89"&gt;
      &lt;div class="a-f-e" style="-webkit-user-select: none;"&gt;
          &lt;div class="d-va-p-Fe a-f-e" style="-webkit-user-select: none;"&gt;
              &lt;img src="https://lh4.googleusercontent.com/-FxDBvNDkbj4/AAAAAAAAAAI/AAAAAAAAAAA/q4f7Fc7OF6A/s48-c/photo.jpg" class="d-va-p-Z a-f-e"&gt;
          &lt;/div&gt;
          &lt;div class="a-f-e d-va-p-yda" style="-webkit-user-select: none;"&gt;
              &lt;div class="d-va-p-Ec a-f-e" style="-webkit-user-select: none;"&gt;Herb Smith&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="d-va-p-iI-oc" style="-webkit-user-select: none;"&gt;
          &lt;span class="a-f-e d-J-Eb-v-YA-Me" style="-webkit-user-select: none;"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>