Reputation: 159
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.
Upvotes: 3
Views: 1460
Reputation: 100175
Do you mean:
$("input[type='button']").click(function(){
$('textarea').focus();
$('textarea').select(); //select text inside
});
Upvotes: 6