Clipboard.getCopyPasteTextArea

Syntax

getCopyPasteTextArea(settings);

Parameters

settings. Text area settings. Optional parameter.

Description

The getCopyPasteTextArea method gets DOM element of the text area, that contains text from the clipboard.

Comments

The method returns a DOM element containing the <textarea> tag.

Example

To execute the example, the HTML page must contain the link to the PP.js script file. Create clipboard and output its contents to browser console. Next copy a new text to the clipboard and show it as a text area:

// Create object of the clipboard
var clipboard = new PP.Ui.Clipboard({
    Data: "a" // Place the string in the clipboard
})
console.log("Initial text is in the clipboard: " + clipboard.paste().getData());
// Copy new string in the clipboard
clipboard.copy("b");
console.log("New text in clipboard: " + clipboard.getText());
// Get and show the text area which the clipboard
var textArea = clipboard.getCopyPasteTextArea();
textArea.style.opacity = 1;
textArea.style.width = "50px";
textArea.style.height = "50px";
textArea.style.height = "50px";
textArea.style.zIndex = 0;
textArea.style.top = "0px";
textArea.style.left = "0px";
document.body.appendChild(textArea);

After the example execution a clipboard is created. Next the clipboard and its contents are shown as a text area:

Initial text and the text copied to the clipboard are output to the browser console:

Initial text in the clipboard: a
New text in the clipboard: b

See also:

 Clipboard