I am trying to create a text box that grows every time a letter is added to it by the width of the character. This is what I’m trying. It doesn’t work. If you’ve got a hint, please share!
JavaScript:
function MakeWidth(el) {
el.style.width = parseFloat(el.value.clientWidth) }
HTML:
<input id="Test" type="text" style="width: 10px;" onkeyup="MakeWidth(this)"/>
Try
size&lengthinstead ofclientWidth&widthhttp://jsfiddle.net/eVd9b/5/
which should be suitable for your needs.