getContentNode();
The getContentNode method returns the DOM node of the text area contents.
Returned value is HTMLElement.
To execute the example, the HTML page must contain links to PP.js script file and to PP.css styles file, in the <body> tag of the HTML page of the <div> item with the textArea identifier. In the onload event of the <body> tag it is necessary to specify the call of the createTextArea() function. Create text area and implement a handler of the ValueChanged event:
function createTextArea() { // Create text area textArea = new PP.Ui.TextArea({ // Set parent item ParentNode: document.getElementById("textArea"), // Set text area contents Content: "", // Set height and width of text area Height: 50, Width: 245, // Set attribute whether text selecting is available TextSelectable: true, // Set event handler of the text area value change ValueChanged: function (sender, args) { console.log("Text area value is changed"); } }); // Add information about component height in text area textArea.setContent("Text area height: " + textArea.getContentNode().clientHeight + " pixels"); }
As a result in the text area there will be information about text area height:
The console will also display the message about text area value change:
Text area value is changed
Text selecting is available because the TextSelectable property is set to True.
See also: