Why isn't this code working?
http://sandbox.phpcode.eu/g/5db40.php
<form> <textarea></textarea> </form> <script> $(function(){ $("textarea").keydown(function(e){ if (e.keyCode == 9){ $("textarea").selectionStart.append(" "); e.preventDefault(); } }); }); </script> You have to press TAB on textarea
Problem is that it doesn't do/append four spaces and it does default browser action (switch to adress tab in Chrome)
Thoughts?
textareas, which generally contain code that is indented, don't allow tabs.