Jump to content

input width


Twentyoneth

Recommended Posts

Hi,

If I understood what you wish, you simply have to put an [b]onKeyUp [/b]event in your input tag. This onkeyUp event has to call a java script function that changes the width of the input field like this:

[!--coloro:#3333FF--][span style=\"color:#3333FF\"][!--/coloro--]onKeyUp='changeWidth(this)'[!--colorc--][/span][!--/colorc--]

function changeWidth(obj)
{

obj.style.width = obj.value.length * (any constant here)

}

where obj is the input field passed as parameter into the onKeyUp event as [!--coloro:#009900--][span style=\"color:#009900\"][!--/coloro--]this[!--colorc--][/span][!--/colorc--].

the constant is any value (in pixels) that multiplies the length of the input field value to make the width of the field looks good ;)

I hope it helps, good luck
Diogo

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.