jasonc Posted September 29, 2010 Share Posted September 29, 2010 I am currently using form_field.cols=20; in my code below to say how many columns, but wish to use the CSS width instead, how do I do this using javascript var container=document.getElementById('namesdiv'); var form_field=document.createElement('textarea'); form_field.id='name' + lines; form_field.name='name' + lines; form_field.cols=20; form_field.rows=2; container.appendChild(form_field); var br_field=document.createElement('br'); container.appendChild(br_field); Quote Link to comment https://forums.phpfreaks.com/topic/214706-adding-new-field-to-page-how-to-specify-the-width-instead-of-cols-of-box/ Share on other sites More sharing options...
Psycho Posted September 29, 2010 Share Posted September 29, 2010 Replace form_field.cols=20; With this (using your preferred value) form_field.style.width = '350px'; Quote Link to comment https://forums.phpfreaks.com/topic/214706-adding-new-field-to-page-how-to-specify-the-width-instead-of-cols-of-box/#findComment-1117197 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.