title: How to export source content within div to text/html file
body: <p>Let's say I have <code>&lt;div id=&quot;main&quot;&gt; ... Some html ...&lt;/div&gt;</code> and I need to take the html code within this div, place it inside a file and force a download of it in <code>TXT</code> format.</p>
  <p>How can that be done? Should I use PHP or JavaScript? I would prefer JavaScript.</p>