Log in

View Full Version : Javascript set button width depending on the length of Text value



ismailc
01-11-2010, 02:43 PM
Good day,

I have button with no width specified.
The text value of the button differs, so i left it with no width.

It automatically sets the width but the problem is it to wide with about 5 spaces on each side of text letting the button look stupid.

I thought of working out the Text in a javascript function then set the length of the button.



<input id="{Description}" type="button" value="{Description}" onClick="{@name}.click(); style="background-color: #f9f9f9; height: 23px;"></input>


Please help

ismailc
01-12-2010, 06:45 AM
Got it going - i'm surpirsed no javascript needed.



overflow: visible;padding: 2px 2px 2px 2px;