javascript textarea.append 1

javascript textarea.append

var $log = $('#myTextArea');

function log(text) {
    $log.append(text);
}

// Call log() in your button click event or whichever function 
// you want to use to print to the text area:

//...
log("Hello world!");
//...

Here is what the above code is Doing:
1. Create a textarea element with an id of myTextArea.
2. Create a variable called $log that references the textarea element.
3. Create a function called log() that takes a string as a parameter.
4. Inside the log() function, append the string to the textarea.
5. Call the log() function in your button click event or wherever you want to print to the textarea.

Similar Posts