phpSensei Posted March 1, 2008 Share Posted March 1, 2008 Is there anyway to access a textfields "class=" and change it with Javascript? I tried document.emailForm.name.class = 'red_border'; doesnt work. Link to comment https://forums.phpfreaks.com/topic/93874-changing-textfield-class/ Share on other sites More sharing options...
fenway Posted March 1, 2008 Share Posted March 1, 2008 I believe it's via className. Link to comment https://forums.phpfreaks.com/topic/93874-changing-textfield-class/#findComment-481032 Share on other sites More sharing options...
haku Posted March 1, 2008 Share Posted March 1, 2008 for firefox (and I believe safari and opera), you use this: document.emailForm.name.setAttribute= ("class", "'red_border"); and for IE you use this: document.emailForm.name.className = 'red_border'; Link to comment https://forums.phpfreaks.com/topic/93874-changing-textfield-class/#findComment-481038 Share on other sites More sharing options...
phpSensei Posted March 1, 2008 Author Share Posted March 1, 2008 Thanks guys, the className worked perfect. Link to comment https://forums.phpfreaks.com/topic/93874-changing-textfield-class/#findComment-481075 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.