difference between .focus() and .select()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Kypriotis
    New Member
    • Mar 2011
    • 37

    difference between .focus() and .select()

    whenever i see a js code wanting to move the cursor to a text input field I see e.g.
    Code:
    document.getElementById("username").focus();
    document.getElementById("username").select();
    is not only focus enough?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    focus() is enough. select() will select the input ready for copying.

    Comment

    Working...