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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.