title: Append element in tag right before contents with Javascript
body: <p>I'll illustrate with an example: I need to convert the following html with javascript</p>
  
  <pre><code>&lt;a&gt;Text 1&lt;/a&gt;
  &lt;a&gt;Text 2&lt;/a&gt;
  &lt;a&gt;Text 3&lt;/a&gt;
  ...
  </code></pre>
  
  <p>to code</p>
  
  <pre><code>&lt;a&gt;&lt;input/&gt;Text 1&lt;/a&gt;
  &lt;a&gt;&lt;input/&gt;Text 2&lt;/a&gt;
  &lt;a&gt;&lt;input/&gt;Text 3&lt;/a&gt;
  ...
  </code></pre>
  
  <p>I don't have a clue how to achieve that with createElement, appendChild or insertBefore/After.</p>