www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] FORMS - resetting a <select> when click in text field ?

  1. #1
    Join Date
    Aug 2007
    Posts
    81

    resolved [RESOLVED] FORMS - resetting a <select> when click in text field ?

    Hi

    I have a form containing a drop-down <select> menu and a text field

    what do I need to do so that if the user selects an item in the drop-down menu and then clicks in the text field, the drop-down is reset back the first index

    I guess I would need to use something like
    PHP Code:
    <input type="text" onfocus="resetMenu()" 
    but what do I need to put in resetMenu() so that it resets the menu back to the first index ?

    thanks

  2. #2
    Join Date
    Sep 2010
    Posts
    62
    Try

    Code:
    document.forms[0].myList.selectedIndex = 1;
    or if your select list has a css id

    Code:
    document.getElementById('myList').selectedIndex = 1;

  3. #3
    Join Date
    Aug 2007
    Posts
    81
    ok - I'll try that

    thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles