jQuery - select all text from a textarea

后端 未结 6 2051
情书的邮戳
情书的邮戳 2020-11-27 12:03

How can I make it so when you click inside a textarea, its entire content gets selected?

And eventually when you click again, to deselect it.

6条回答
  •  悲哀的现实
    2020-11-27 12:52

    $('textarea').focus(function() {
        this.select();
    }).mouseup(function() {
        return false;
    });
    

提交回复
热议问题