【发布时间】:2014-09-15 11:05:07
【问题描述】:
我想创建一个 CSS 类来使输入字段是只读的。
这是我的尝试:
<style>
.enableInput input[readonly] {
color: #CB000F;
}
</style>
<script>
function changeCss()
{
$("#desg").addClass("enableInput input");
}
</script>
</head>
FirstName:<input type="text" name='fname' id='fname' onBlur="changeCss();">
Designation:<input type="text" name='desg' id='desg' value='Software Engr'>
</html>
【问题讨论】:
-
不能使用 CSS 修改 DOM 属性。
标签: javascript css