We would like to know how to style disabled element with Javascript.
<!DOCTYPE html>
<html>
<head>
<style>
input[disabled] {<!-- www . java 2 s .c o m-->
background: yellow;
}
</style>
</head>
<body>
<input id="foo" type="text">
<script>
document.getElementById('foo').disabled = true;
</script>
</body>
</html>
The code above is rendered as follows: