Simple Indent for HTML TextAreas
Part of my job involves me occasionally editing css, html, xml, javascript, etc inside of html textareas. Pretty cumbersome, but it makes sense for us and I won’t bore you with the details. One thing that drives me nuts is having to manually indent each line of code that I write using the spacebar. This gets old quickly and typically turns into a big mess.
Today I whipped up a jQuery plugin called SimpleIndent. When used on a textarea, the textarea will magically remember indentation (spaces only, no tabs). Oooooh, aaaaah. Now that shitty old textarea is almost useable for coding! Ok, not really, but it’s a hell of a lot better.
The plugin is invoked like this:
jQuery(‘textarea[name="body"]‘).SimpleIndent();
Just replace ‘textarea[name="body"]‘ with the selector for your textarea and you’re good to go. I know there are a lot of serious html/js code editors out there, but I didn’t need all of the functionality and it was more fun to write something myself