title: Replace text with empty string by class in html using javascript
body: <p>I'm trying to create a js function which removes text onclick from a certain class of fields in HTML.  </p>
  
  <p>When checking Yes in the trigger (onclick), the function is not clearing the data in my target.</p>
  
  <p>This works if I substitute id for class where appropriate, but I need the function to affect 10+ html fields. Can this be accomplished by class?</p>
  
  <p>Note: There is a little extra in the HTML below because there is another js function run onclick in my trigger. I've removed the divs, so it's less cluttered.</p>
  
  <p>JavaScript </p>
  
  <pre><code>function eraseText() {
    document.getElementsByClassName("eraseonupdate").value = "";
  }
  </code></pre>
  
  <p>HTML </p>
  
  <p>Trigger:</p>
  
  <pre><code>&lt;input type="radio" name="exceptionupdate" class="_exceptionupdate" value="Yes" onclick="ExceptionUpdate();eraseText()" /&gt;Yes &lt;input type="radio" name="exceptionupdate" class="_exceptionupdate" value="No" onclick="ExceptionUpdate()" /&gt;No
  </code></pre>
  
  <p>Target:</p>
  
  <pre><code>&lt;input type="text" name="Approver" size="20" class="eraseonupdate"&gt;
  </code></pre>