LoginSignup
11

More than 5 years have passed since last update.

テキストボックスの文字を全選択させる

Posted at
<input type="text" id="text"/>
$('#text').on('click', function(e) {
  e.target.setSelectionRange(0, e.target.value.length);
});

iosがjQueryの.select()使えないのでこれで

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11