So, I have something like this:
<p>Enter Latex:
<input id="input" onchange="render()" />
</p>
<p>Preview:</p>
<div class="box">
<div id="output" class="output"></div>
</div>
I also have a button. I just don't know how to make button take the stuff from output and store it into a cell with the same format it is in.