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

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -