Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Longer text input html

  • 17-04-2015 06:31PM
    #1
    Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭


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


Comments

  • Closed Accounts Posts: 9,698 ✭✭✭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, Registered Users 2 Posts: 200 ✭✭druidhill


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


  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭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, Registered Users 2 Posts: 200 ✭✭druidhill


    Yes, that would be my understanding too.


  • Registered Users, Registered Users 2 Posts: 2,011 ✭✭✭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,698 ✭✭✭tricky D


    ^

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


Advertisement