315920-22.html (629B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <style> 5 label {color: red} 6 #one[disabled]:disabled + label {color: green} 7 #two:not([disabled]):not(:disabled) + label {color: green} 8 </style> 9 </head> 10 <body onload='var elem = document.getElementById("one"); 11 elem.setAttribute("disabled", "disabled"); 12 document.getElementById("two").removeAttribute("disabled")'> 13 <div> 14 <input id="one"/> 15 <label for="one">Should be no red</label> 16 </div> 17 <div> 18 <input id="two" disabled="disabled"/> 19 <label for="two">Should be no red</label> 20 </div> 21 </body> 22 </html>