title: Redirect to new page on button onclick in javascript
body: <p>I have many buttons inside of webpage like this.</p>
  
  <pre><code>&lt;div class="btn btn-sm btn-success mycustom_btn"  onClick="javascript:clickinner();"&gt;more&lt;/div&gt;
  &lt;div class="btn btn-sm btn-success mycustom_btn1"  onClick="javascript:clickinner();"&gt;more&lt;/div&gt;
  &lt;div class="btn btn-sm btn-success mycustom_btn2"  onClick="javascript:clickinner();"&gt;more&lt;/div&gt;
  </code></pre>
  
  <p>What i am trying to do is call  function clickinner() on button onclick event. I tried to grab the button element by class name and change the target url.
  The javascript code is as follows.</p>
  
  <pre><code>&lt;script&gt;
  function clickinner(){
      var mybtn=document.getElementsByClassName('btn');
      mybtn.onClick="location.href='about-us.html'";
  };
  &lt;/script&gt;
  </code></pre>
  
  <p>I don'twant to grab the element by Id so that i have to assign unique id each time. However whenever i click on any of buttons, the target link is not working.
  Please help me.</p>