I'm dynamically adding a textarea box via Javascript to a form. The box needs to mimic existing textarea boxes (populated from PHP). I'm encountering a style glitch that I can't seem to get past.
Normally, when you click into a 2-row textarea box, the cursor appears in the top row of the box. With the dynamically-added textarea box, the cursor is centered and spans both rows. When you begin typing, the text is vertically centered rather than in the top row. I'd like my application to appear professional, so I'm not thrilled with this style glitch.
Here is the Javascript that adds the textarea box (the vertical-align attribute doesn't seem to help):
var cell3 = row.insertCell(2);
var element3 = document.createElement('input');
element3.type = 'textarea';
element3.name = 'summary[]';
element3.setAttribute('rows', '2');
element3.setAttribute('cols', '40');
element3.setAttribute('style','height: 2.8em; width: 320px; vertical-align: top;');
cell3.appendChild(element3);
Here is the normal HTML version generated by PHP:
<td><textarea name="summary[]" style="height: 2.8em; width: 320px;"></textarea></td>
See attachment for a screen-shot of the glitch (and forgive my lame art).
The design is almost exclusively for Firefox, btw.