anilkumar Posted July 5, 2006 Share Posted July 5, 2006 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 More sharing options...
jaikiran Posted July 5, 2006 Share Posted July 5, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now