title: Use AJAX to keep tabs in textarea?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6140632/how-to-handle-tab-in-textarea">How to handle &lt;tab&gt; in textarea?</a>  </p>
  </blockquote>
  
  
  
  <p>I need a way to maintain tab levels in a textarea, so far this is what I have used:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
     $("textarea").keydown(function(e) {
        var $this, end, start;
        if (e.keyCode === 9) {
           start = this.selectionStart;
           end = this.selectionEnd;
           $this = $(this);
           $this.val(
              $this.val().substring(0, start)
              + "\t" + $this.val().substring(end)
           );
           this.selectionStart = this.selectionEnd = start + 1;
           return false;
        }
     });
  &lt;/script&gt;
  </code></pre>
  
  <p>But this only inserts tabs (I found this on another SO post so I don't really know what it does as I'm not a JS expert )</p>
  
  <p>Is there a way for those tabs to be there when I hit the return key? I need this because I am making a very simple code editor for my admin panel (no need for syntax highlight or anything) and it uses TextAreas.</p>
  
  <p>Thanks!</p>