html - Is it possible to target a <select> with a specific option selected? -


say have following html:

<select>     <option value="0">closed</option>     <option value="1">open</option> </select> 

i'd add border <select> depends on selected value:

  • red border when closed selected
  • green border when open selected

select open closed

is there css selector target <select> when value 0 or 1?

this not possible purely in css, css not have understanding of selected dropdown options. (even if did, not possible match option go parent select).

as such, javascript option here. can provide example, didn't tag question javascript don't know if option you.


Comments

Popular posts from this blog

mod rewrite - Using "?" when rewriting the URL -

.htaccess: Transfer name to index.php if not directory public -

Admob integration with pygame in android -