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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    137
    Thanks
    1
    Thanked 0 Times in 0 Posts

    question about select tag

    I would like an option in the select tag not to be selected by default but appear as the first option when the file is loaded. i have used the following code

    <option disabled="disabled" selected="selected">Select Category</option>

    however this works in firefox but not in Internet Explorer how can i change the above code to work in both the browsers

    please advice.

    thanks.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,866
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Code:
    <select name="mylist" disabled="disabled">
    	<option >1</option> 
    	<option  selected="selected">Select Category</option> 
    	<option >3</option> 
    </select>
    should work in both!
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Jun 2008
    Posts
    67
    Thanks
    3
    Thanked 13 Times in 13 Posts
    Just make it your first option. Drop the "selected", as its not needed, and drop disabled too, as that (i presume) makes it unselectable (and therefore, not the first option on the list). Use whatever scripting language you know to validate form input.


  •  

    Posting Permissions

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