Question

I have the following textarea:

<textarea id="edit-note-text" autocorrect="on"><%= text %></textarea>

While this text area is in use or, in other words, while someone is typing, I need to dynamically set the autocorrect attribute to off and back to on:

<textarea id="edit-note-text" autocorrect="off"><%= text %></textarea>

Unfortunately this doesn't seem to work:

document.getElementById(‘textarea’).setAttribute(‘autocorrect’, ‘off’);

I'm in a iOS UIWebView and could try to do this natively if possible as well but this is what comes to mind first. Is this possible?

Was it helpful?

Solution

<!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 like this maybe that you need

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top