stijn0713 Posted February 18, 2012 Share Posted February 18, 2012 Hello, i want to validate textfields, radio groups, dropmenu's and checkboxes and make the border red when something is wrong... but it seems only to work with the textfields and dropmenu's? function formValidator() { for (i=0;i<errors.length;i++) { document.getElementById(errors).style.border="1px solid red"; } Any idea's? thanks! Quote Link to comment Share on other sites More sharing options...
UrbanDweller Posted February 19, 2012 Share Posted February 19, 2012 Hey, I havent done much in the way off css manipluation with javascript but one way I did it was by... document.getElementById(errors).className = "ClassID"; So you have another css class with the changes you want then change the elements class. Longer way just i havent used much js style etc. Quote Link to comment Share on other sites More sharing options...
haku Posted February 21, 2012 Share Posted February 21, 2012 for (i=0;i<errors.length;i++) { document.getElementById(errors[i]).style.border="1px solid red"; } This assumes that errors is an array containing a number of element IDs. Quote Link to comment Share on other sites More sharing options...
stijn0713 Posted February 28, 2012 Author Share Posted February 28, 2012 Yes that's what i have, but it only makes the textfields and radio buttons red. I guess it's not supported by the browsor for checkboxes? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.