Download a text file from textarea on Button Click
<p>I am using <code>Jquery UI Dialog</code>. Within the dialog there is textarea that have some text. And I need to save that text as textfile like <code>data.txt</code> when I click the button in the dialog.</p>

<pre><code>&lt;div id = 'metaDataDialog' title='Meta Data' &gt;
  &lt;textarea id = 'metaText'&gt;
     Some Text
  &lt;/textarea&gt;
&lt;/div&gt;
</code></pre>

<p>and this is the jquery ui dialog</p>

<pre><code>$("#metaDataDialog").dialog({ //Jquery UI Dialog Intialization
           autoOpen: false, 
           modal: true, 
           width: 400,
           height: 300, 
           buttons: {
              Save: function() {},                   
              Cancel: function() { $(this).dialog( "close" ); }
           },                  
        });     
</code></pre>

<p>and I need to save/download the text in the local machine, when the <code>save</code> button is clicked</p>