What I'm trying to do is basically create a plugin to generate the innerHTML of a div content called main and download it as a text file. However I don't want to get the post-rendered html after it runs all the js/jquery functions. I managed to do this however the problem is that it generates everything.

HTML:

```
<button id= "clickhere">CLICK HERE</button>
<div id="main">
    <p id="yeah" class="hide">asdasdadadad</p>

    <span>Hey there</span>
</div>

```

CSS:

```
.hide{
    display: none;
}

```

JS:

```
$('#clickhere').click(function(){
    //location.reload();
    downloadeverything();
});

function downloadeverything(){

function downloadInnerHtml(filename, elId, mimeType) {

    var elHtml = document.getElementById(elId).innerHTML;

    var link = document.createElement('a');
    mimeType = mimeType || 'text/plain';

    link.setAttribute('download', filename);
    link.setAttribute('href', 'data:' + mimeType + ';charset=utf-8,' + encodeURIComponent(elHtml));
    link.click(); 
}

var fileName =  'testing.txt';
downloadInnerHtml(fileName, 'main','text/html');
}

    $('#yeah').show('puff', 750);

```

Obviously my project is bigger but I created a sample fiddle to show the problem. Basically when I add the fadeIn or puff Jquery animation the txt file generated gives me a style: display:block on the txt file as shown in the picture.
![enter image description here](https://i.stack.imgur.com/fvdBt.jpg)

I found a non-ideal workaround which is to add the download function on the top so it runs first but then again that's not what I want as it doesn't work when I have more than 1 js file running.

I've also tried to force reload and immediately download but it doesn't work. Is there a way of pre-rendering the html file as txt so i can get the text i want or setting the html content to string when i click the download button?

My sample: <http://jsfiddle.net/yomuffin89/fzg39sk5/8/>

**Update:** I need to include script tags with animation within the main div(i know .. but its ie6) so if the code generates in sequence then it gets everything within that div. is there a way to run the file as txt so it gets just that div content as text without anything applied to it afterwords?

updated fiddle: <http://jsfiddle.net/yomuffin89/fzg39sk5/13/>

If anyone can help I would be grateful.