title: Javascript element html without children
body: <p>In my javascript code I need to get the definition of an element, but without its content - neither text nor children.</p>
  
  <p>E.g. for:</p>
  
  <pre><code>&lt;div id="my_example_id" class="ShinyClass"&gt;
     My important text
     &lt;span&gt; Here&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I would like to write a javascript fucntion that when provided with the element of the div above will return the following as string:</p>
  
  <pre><code>&lt;div id="my_example_id" class="ShinyClass"&gt;
  </code></pre>
  
  <p>I have been trying with different manipulations over the elements, functions like <code>innerHTML</code>, <code>outerHTML</code> and similar, but I was unable to figure out how to fetch only the part I am interested in. Is substring until the first <code>&gt;</code> the best possible solution?</p>
  
  <p><strong>EDIT</strong>: selecting the element is not part of the question - I know how to do that, no prob. Rather the question is: when I have already selected a particular element how to parse as string only its own definition.</p>