-2

I have a simple form, with a textarea field, I need to append some texts to textarea with JavaScriptSpellCheck plugin attached.

I have tried: .append, .html, .text using jQuery , and javascript but nothing happens.

I read the documentation (http://www.javascriptspellcheck.com/Object_Reference) but I can't get something useful, there any way possible?

Thanks in advance!!!

My are simple, just a common simple textarea, but when the plugin is attached I cant add a dynamic text to the textarea, the situation : When the user click on "Tips or Examples", I need to append/add to my textarea.. but i cant destroy the plugin or make something to add the text,

$('textarea').spellAsYouType({ checkGrammar:true, showLanguagesInContextMenu: false, userInterfaceTranslation:'es', theme:'bright' });

I try to add some text but doesnt work!, I see only the words 'test' but only work if the user type the word on the textarea, I need to make this 'dynamic'... when the plugin is attached my textarea is hidden and add some divs on my form.

Capture (Firebug/HTML) http://psylux.com.ar/rose/javascriptspellcheck.jpg

2 Answers2

0

I don't know if I understood your question very well, but this code put some content into a textarea.

<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="UTF-8">
    <script>

        window.onload = function(){ //when the page is loaded

            document.getElementById('yourtext').value = prompt("Type what dou you wanna appear: ");
            //you take the value of element and put into the content of the prompt
        }
    </script>
</head>
<body>

<label for="yourtext">Seu texto</label>
<textarea id="yourtext"></textarea>
</body>
</html>
João Nobre
  • 51
  • 1
  • 10
0

try this if you want input from user

 $(document).ready(function () {
        $('#txtTextArea').val(prompt('your msg'));
    });

Or try this if you want some predefined static value

$(document).ready(function () {
    var ranStaticText = ["text1", "text2", "text3", "text4", "text5", "text6"];
    $('#txtTextArea').val(ranStaticText[parseInt(Math.random()*ranStaticText.length)] );
});
Satish Kumar sonker
  • 1,250
  • 8
  • 15