textareaを選択した時に全選択をする
前回記事(iPhoneのSafari(Mobile Safari)のselect()は、代わりにselectionStart, selectEndを使わなければいけない - yohtnのブログ)の応用で、textareaを選択した時に全選択をするjQueryコードです。
<textarea id='id'></textarea>
というtextareaがある前提です。
$('#id').click(function(){ id = document.getElementById('id'); id.selectionStart = 0; id.selectionEnd = id.value.length; });