我想知道是否可以将以下css转换为javascript?所以基本上它应该在onchange之后实现样式规则。
.appnitro input:required:valid, .appnitro textarea:required:valid {/* when a field is considered valid by the browser */
box-shadow: 0 0 5px #5cd053;
border-color: #28921f;
}
.appnitro input:focus:invalid, .appnitro textarea:focus:invalid { /* when a field is considere invalid by the browser */
box-shadow: 0 0 5px #5d45252;
border-color: #b03535;
}
<script>
function myFunction(){
??????
}
</script>
<form id="form_664184" class="appnitro" method="post" action="">
<input type="text" id="element_3" name="element_2_1" value="Title" onchange="myFunction()" required />
</form>