views:

38

answers:

2

My textarea contains C# code, so i get red underlines all over the place, is there any way to disable auto correction on a TEXTAREA in html code?

Thank

+5  A: 

I believe you may be looking for <textarea spellcheck="false"></textarea>

Source: https://developer.mozilla.org/en/controlling_spell_checking_in_html_forms

Robert
thanks, is there a way to add this to my css file? it works if i place it in my html code, but using it with css doesn't seem to workTEXTAREA.code{ spellcheck:false;}<textarea class="code"></textarea>
aryaxt
This is an HTML5 attribute so can't be handled in a CSS file. It needs to be part of the textarea markup itself. :-)
hollsk
+1  A: 

Try adding the following code to your textarea:

 spellcheck="false"

Note that this will make your code invalid so you might want to inject it with javascript or something after the DOM has loaded if it's important to you.

hollsk