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. Quote 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. Quote 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'; Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/93874-changing-textfield-class/#findComment-481075 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.