title: Make onclick work on iphone
body: <p>I have been using "onclick" in my javascript, but now I want it to work on Iphone as well. Is there a simple way to make all "onclick" to work like ontouchstart for devices that support ontouchstart?</p>
  
  <p>Or do I need to write all script twice (one that uses onclick and one that uses ontouchstart)? :S</p>
  
  <p>Note: I dont want to use jquery or any other library.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;title&gt;li:hover dropdown menu on mobile devices&lt;/title&gt;
  &lt;script&gt;
  window.onload = function () {
      if ('ontouchstart' in window) {
          // all "onclick" should work like "ontouchstart" instead
      }
      document.getElementById('hbs').onclick = function () {
          alert('element was clicked');
      }
  }
  &lt;/script&gt;
  &lt;a id=id1 href=#&gt;button&lt;/a&gt;
  </code></pre>