-
-
Save tallykatt/ea6290195c128316fe19c5762ef65ea7 to your computer and use it in GitHub Desktop.
Bookmarklet: allow tabs in textareas (requires jQuery)
Create a toolbar bookmark with this code. Click it when you want to be able to use tabs in a textarea.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:$(document).delegate('textarea', 'keydown', function(e) { var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); var start = $(this).get(0).selectionStart; var end = $(this).get(0).selectionEnd; $(this).val($(this).val().substring(0, start) + "\t" + $(this).val().substring(end)); $(this).get(0).selectionStart = $(this).get(0).selectionEnd = start + 1; }});void(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment