开发者

How can I highlight certain options in a HTML select - using javascript

开发者 https://www.devze.com 2023-01-23 09:23 出处:网络
I saw this post: How can I highlight certain options in a HTML select using jQuery which is similar to what I need to do, except a bit too complicated for my understanding.In the html body, I have

I saw this post:

How can I highlight certain options in a HTML select using jQuery

which is similar to what I need to do, except a bit too complicated for my understanding. In the html body, I have a dynamically changing select form. The user can select multiple items from this form, and click a button ("Display") to run a javascript function. This function already goes through the list to determine whic开发者_JS百科h ones have been selected and uses the information somewhere else.

I would like it so that when the user clicks "Display", the items that were selected will be highlighted (and each with a specific color).

What do you think?


Yes! I figured it out.

myList.options[i].style.backgroundColor='yellow';
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号