Select the Textarea using Button

html, jquery, jquery-selectors

Solution

Do you mean:

$("input[type='button']").click(function(){
    $('textarea').focus();
    $('textarea').select(); //select text inside
});

Problem

I want to select the textarea field when user click on button. My Code: ``` <textarea readonly="readonly"> </textarea> <input type="button" value="Code"/> ``` Jquery Code: ``` $(function() { $(input:button').click(function(){ ('textarea').select(); }); }); ``` It's not working.

Original source