I’m writing an editor, and would like for the input field to be the width of the column.
So far, I have:
$td.html('<input name="test" value="' + $td.text() + '" size="' + $td.width() + '">');
The problem is: $td.width() is reporting numbers like 80 and 25, but the input needs to be in character widths.
Even though my css says:
html {
font-size:20px;
}
I don’t see any relation between the $td.width() and the size attribute. You would think it would be $td.width()/20.
I believe font-size:20px specifies the hight of the font, not the width. Width will be heavily dependent on font used, and will vary based on characters (unless fixed width). You will need to find out the default font used by a textbox.
I have however, found the following code snippet which claims to set the width of a textbox in pixels rather than characters:
Try entering
width: 100%or similar and see if that works?