title: Javascript - onfocus set caret position to 0
body: <p>I found a possible solution to my question, however, since I'm new to javascript I can't seem
  to get the desired behaviour. </p>
  
  <p>The solution is posted by mcpDESIGNS here</p>
  
  <p><a href="https://stackoverflow.com/questions/512528/set-cursor-position-in-html-textbox">Set keyboard caret position in html textbox</a></p>
  
  <p>What I wish to have is force the caret position back to 0 as soon as the field is focused
  I have created a fiddle which will help demonstrate what I'm doing. </p>
  
  <p>fiddle: <a href="http://jsfiddle.net/KuLTU/" rel="nofollow noreferrer">http://jsfiddle.net/KuLTU/</a></p>
  
  <pre><code>addLoadEvent(function() {
  document.getElementById("search_string").onfocus = search_field_focus;
  });
  
  function search_field_focus() {
      setCaretPosition("search_string", 0);
  }
  </code></pre>
  
  <p>I assume the way I'm calling setCaretPosition is wrong, any suggestion?</p>