Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2012
    Posts
    12
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Setting selectedIndex not working in IE8

    Does anyone know why this would be working in Firefox but not in IE8?

    document.getElementById("myFormID").selectedIndex = 0;

    This script runs on page reload to reset the form values to their defaults.

    Susan
    Last edited by Maguire; 07-01-2012 at 07:45 PM.

  • #2
    Regular Coder Nile's Avatar
    Join Date
    Jun 2008
    Posts
    280
    Thanks
    2
    Thanked 46 Times in 46 Posts
    Try .options.selectedIndex

    Keep in mind, you can use .reset() to reset a form just as type="reset" will do.
    Code:
    document.forms[0].reset();

  • Users who have thanked Nile for this post:

    Maguire (07-01-2012)

  • #3
    New Coder
    Join Date
    Jun 2012
    Posts
    12
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Oh wonderful! Thanks.

  • #4
    Regular Coder Nile's Avatar
    Join Date
    Jun 2008
    Posts
    280
    Thanks
    2
    Thanked 46 Times in 46 Posts
    No problem


  •  

    Posting Permissions

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