javascript into an iframe (resubmitted)
<p>I am developing a live code editor and I am trying to add a javascript-specific box to it
to go alongside the css and html boxes that I already have, the problem is that I don't know how to do it, properly that is.</p>

<p>This is the script I've developed so far (based on jQuery 1.7)</p>

<pre><code>(function () {
    $('.grid').height($(window).height());

var contents = $('#result').contents(),
    body = contents.find('body'),
    styleTag = $('&lt;style&gt;&lt;/style&gt;').appendTo(contents.find('head'));

$('textarea').keyup(function () {
    var $this = $(this);
    if ($this.attr('id') === 'html') {
        body.html($this.val());
    } else {
        // it had to be css
        styleTag.text($this.val());
    }
});
</code></pre>

<p>If anyone could help me add the javascript area that would be awesome.</p>

<p>BTW please don't close this I have been wanting to find a solution but none of the questions are what i directly need.</p>
