Jump to content

Regarding font color in <select>


anilkumar
 Share

Recommended Posts

Hi all, When I am disabling the <select> dropdown with the element chosen displayed in it, using onload function, i am unable to change the color of the selected element when it is disabled.I have tried to use style tag but it is not coming.I have tried to use fontcolor javascript attribute , but i unable to get it.So please suggest me regarding it.Thanks all.

Link to comment
Share on other sites

The following works in FireFox, but not in IE:

<html><head><style>select[disabled] {color:red!important;}</style><script type="text/javascript">function changeMyCol(){var s = document.getElementById("s1")s.disabled="true"}</script></head><body ><select id="s1" > <option id="o1">Colour1</option> <option id="o2">Colour2</option></select><p><input type="button" id="b1" value="Click me to disable and change colour" onClick="changeMyCol()"/></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...