Textarea select() Method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Textarea

Description

The select() method selects the contents of a text area.

Parameters

None.

Return Value

No return value.

The following code shows how to Select the contents of a text area:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Address:<br>
<textarea id="myTextarea">
test</textarea>

<button type="button" onclick="myFunction()">Test</button>

<script>
function myFunction() {/*from ww  w.jav a  2s.  c o  m*/
    document.getElementById("myTextarea").select();
}
</script>

</body>
</html>

Related Tutorials