Select Text After Alert Message Show In JavaScript

  1. <html>  
  2.   
  3. <body>  
  4.     <form> Select text: <input type="text" value="Hello world!" onselect="alert('You have selected some of the text.')"> <br /><br /> Select text: <textarea cols="20" rows="5" onselect="alert('You have selected some of the text.')">  
  5. Hello worl!</textarea> </form>  
  6. </body>  
  7.   
  8. </html>