3

How to make all text in textarea selected when user open it through jquery?

1
  • Not sure if your question is unambigously... Commented Jun 14, 2012 at 16:54

3 Answers 3

6
$('textarea').on('mouseup', function() { $(this)[0].select(); });​ 

http://jsfiddle.net/Tu9N7/

Sign up to request clarification or add additional context in comments.

Comments

1

Input.select

var eraInput = document.getElementById('era'); eraInput.select(); 

1 Comment

Wow, great stuff here, jQ didn't do the job, this one did.
0
$('textarea').focus(function() { this.select(); }) 

DEMO

From the line "when user open it through jquery" I think you need something like:

$('textarea').slideDown(function() { $(this).focus(); }).focus(function() { this.select(); }); 

Here I assume your textarea is hidden and you opened it using jQuery event and after open it text will be selected by default.

DEMO

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.