How to select the contents in the text view textrea in wp_editor?

The TinyMCE editor have functions in his API to get the content of the editor.
To get all content of selection use the follow source:

tinyMCE.activeEditor.selection.getContent();

WordPress have since 4.3 a lot fo changes on the editor. Use always the API 4 for find the right functions in the documentation page.
Here for documentation about get content inside the editor. All helpful functions of the API find you in this link below.

To get all content use tinymce.activeEditor.selection.getNode().

For the usage in the WordPress environment can you also use jQuery, is a part of the core. As example create a instance of tinymce and add your source.

jQuery( document ).ready( function( $ ) {

    tinymce.PluginManager.add( 'Your_Namespace', function( editor ) {

                if ( typeof(
                        tinymce.activeEditor.selection.getContent()
                    ) != 'undefined' ) {
                    marked = true;
                }

                if ( marked == true ) {
                    var content       = tinymce.activeEditor.selection.getContent(),
                        start_content = tinymce.activeEditor.selection.getStart().nodeName,
                        all           = tinymce.activeEditor.selection.getNode()
                }

                // Debug in Console
                console.log(all);

    } );
} );