Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

controlling <select> tag attributes

Status
Not open for further replies.

jermine

Programmer
Jun 15, 2001
59
SG
thanks for taking time to read this ...
my problem is this :

i have a select box that is initially empty and only populated by selecting a value from a previous select box, lets name it "parentSelect".
its width is the default or just simply uses this code :
<select name=&quot;select1&quot; multiple size=&quot;10&quot;>

once a value is selected from &quot;parentSelect&quot;, &quot;select1&quot; gets populated.... the new content's character length lets say reaches 200, the width of &quot;select1&quot; doesnt change... and the text inside is cut off or incomplete!

is there any way i can work around this, where the width adjusts based on the length of whats inside the box?




 
why not &quot;not&quot; specify the width so it auto expandes with the entries? You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
you can do it with JS

onChange=&quot;document.framename.select1.size=200;&quot;

Note: Don't forget to put your own names in framename and select1.

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Or, you could put the select in a div and instead of populating the select, write a new select to the div using innerHTML.

Rick if(($question==&quot;has been bugging me&quot;
AND $answer==&quot;fixed the problem&quot;) OR $answer==&quot;really good post&quot;){
print(&quot;Star&quot;);
}else{
print(&quot;Thanks.&quot;);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top