Set html textarea attribute dynamically?
I have the following text box:
<textarea id="edit-note-text" autocorrect="on"><%= text %></textarea> While this text area is being used or, in other words, when someone is typing , I need to dynamically disable the autocorrect attribute and enable it:
<textarea id="edit-note-text" autocorrect="off"><%= text %></textarea> Unfortunately this does not work:
document.getElementById('textarea').setAttribute('autocorrect', 'off'); I am in iOS UIWebView and can try to do it initially if possible, but this is what comes to mind first. Is it possible?
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script> //Declare functions function taFocus(element){ element.setAttribute("autocorrect", "off")} function taBlur(element){ element.setAttribute("autocorrect", "on")} </script> </head> <body> <textarea id="edit-note-text" autocorrect="on" onfocus="taFocus(this);" onblur="taBlur(this);" >texto</textarea> <textarea id="edit-note-text2" autocorrect="on">texto</textarea> </body> </html> Some, for example, may be needed.