jquery - paragraph Select() doesn't work in javascript -


here html code

<div id="dialog" title="basic dialog" style="display: none">   <p id="para">copy key</p>     <p id="key">4567887654345678</p> </div>  <button>open dialog</button> 

the div appears dialog on button click, , have

"key" text selected when dialog opens

here javascript same, < p> doesn't appear selected

$(function() {     $( "button" ).click(function() {       $("#dialog" ).dialog();         $( "#dialog" ).show( "slow" );                 $("#key").select();   });     }); 

how can make < p> pre-selected ?

change key paragraph editable element, such textarea:

<textarea id="key">4567887654345678</textarea> 

jsfiddle

it appears need editable text field select text in.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -