Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Longer text input html

Options
  • 17-04-2015 6:31pm
    #1
    Registered Users Posts: 1,550 ✭✭✭


    How do I make a text input in html longer without imposing a maximum length?


Comments

  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    use maxlength="value" in the input field

    http://www.w3schools.com/tags/att_input_maxlength.asp

    allows a limit of just over half a million characters


  • Registered Users Posts: 200 ✭✭druidhill


    I think you are asking with regards to display, so use the size attribute (default is 20).


  • Registered Users Posts: 1,550 ✭✭✭quinnd6


    I meant the size of the input box on the screen as in how many characters fit into it onto the screen before you end up scrolling right to get to the next character.
    I think just setting a size does that anyway as druidhill just mentioned above.
    From experimentation there size doesn't seem to limit the amount of characters you can input.
    Am I right?


  • Registered Users Posts: 200 ✭✭druidhill


    Yes, that would be my understanding too.


  • Registered Users Posts: 2,030 ✭✭✭colm_c


    Use size attribute.

    Or just style it with a bit of css.

    HTML:
    [HTML]
    <input type="text" class="wide">

    <input type="text" class="narrow">
    [/HTML]

    CSS:
    input.wide {
    width: 100px;
    }
    
    input.narrow {
    width: 10px;
    }
    


  • Advertisement
  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    ^

    Note on the above: Try to use ems and percentages which work better for Responsive Design than pixels.


Advertisement