Javascript - get contents of div, decode base64, replace the same div with decoded contents
<p>Lets say I have a page with a div, which might or might not (no control over contents) have base64 encoded contents. I have a button, which when clicked will get the contents of the div, decode the base64 and then replace that same div with the decoded contents.</p>

<p>I know that innerHTML can get contents of whichever element.<br>
I know that <code>btoa()</code> and <code>atob()</code> can decode base64, and there are enough functions on the web to do it for IE.</p>

<p>I however don't know how to combine the two, and afterwards replace the contents of that same div with the decoded result. What would be the best way to do above thing? Jquery is available, other frameworks are not.</p>
