If i have saved all the fields in a form to an array,
var reqfield = document.getElementsByClassName("req");
how can i set the css style of a single field based on said array.
document.getElementById("myform")reqfield[1].style.backgroundColor = "red";
You've already got the item stored in the array. It should just be
reqfield[1].style.backgroundColor = "red";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.