.select()


.select()Returns: jQuery

Description: Selects an element.

  • version added: v0.1.1.select()

    • This method does not accept any arguments.

This function will select or highlight the contents of an element.

Consider the following example:

1
2
3
4
5
6
7
<div>
<p class="select">Some text to select</p>
</div>

<script>
$( ".select" ).select();
</script>

The text "Some text to select" will be selected.

The .select() process is an extention to the existing jQuery function, .select(). When .select() is used on a <textarea> or <input> tag, the original .select() function will be used instead. This will also be the case if any parameters are provided, as it would be used for .select( handler ).