Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Different color for option in one class

  • mforster
  • mforster's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 9 months ago #155820 by mforster
Different color for option in one class was created by mforster
Hello everyone,

I'm actually building a dropdown list with Category in an Array(Text). I follow some instruction and my list look like this :

var select1 = '<select class="inserted-select"> \
<option value="">--Please Choose --</option> \
<option value=""disabled>Class 1</option> \
<option value="Student1">Student1</option> \
<option value="Student2">Student2</option> \
<option value="Student3">Student3</option> \
<option value="Student4">Student4</option> \

I can disable the "Class1", but i would like to change the policy & the color of this one. Is it possible ?

Sorry if it's an obvious one, I'm only a "novice Javascripter" !

Many thanks for your help
The topic has been locked.
  • markusfluer
  • markusfluer's Avatar
  • Visitor
  • Visitor
6 years 9 months ago #155826 by markusfluer
Replied by markusfluer on topic Different color for option in one class
Hello,

you can use simple css for that
Code:
var select1 = '<select class="inserted-select"> \
<option value="">--Please Choose --</option> \
<option value="" style="color:red;" disabled>Class 1</option> \
<option value="Student1">Student1</option> \
<option value="Student2">Student2</option> \
<option value="Student3">Student3</option> \
<option value="Student4">Student4</option> \

That will change the font color of the disabled 'Class1' to red(#ff0000).
Here is a good introduction to css: www.w3schools.com/css/css_examples.asp
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose