Using jQuery, can we set a portion of a <option> text to certain color? For example:
<option>John, Rambo, Indiana, Jones, Morpheus, John, McClane, Forrest, Gump</option>
If I want to just change the color of “Morpheus”. Is it possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you meant option value of a
selectbox, there is no easy way or even cross-browser solution. You will have to resort to some custom solution usingLIsto mimic a customized select box and then you can style it with jquery.For example, check out the one option here that you can customize (add colors, etc) however you like.