14
<input id='input1' type='text'></input>
<input id='input2' type='button'></input>
<input id='input3' type='checkbox'><input>
<textarea id='myTextArea'></textarea>

In HTML markup, most places where the user can interact with the page are denoted with the <input> tag. Why is it that textarea has its own tag, <textarea> as opposed so, say, <input type='textarea'>

2

3 Answers 3

11

Because <textarea> has the rows and cols attributes that are specific to it. If it were a type of <input>, these attributes would have to be part of the <input> tag even though they serve no purpose for the other types.

3
  • 13
    Strangely, though, <input type="checkbox"> and <input type="radio"> have a checked attribute not used by any other input type. Similarly, <input type="image"> shares attributes with the <img> tag. Additionally, <input type="button"> shares functionality with the <button> tag.
    – greyfade
    Dec 28, 2011 at 19:32
  • 14
    @greyfade: Let he whose incremental designs are completely consistent cast the first stone... Dec 28, 2011 at 19:46
  • 2
    @MichaelBorgwardt where can I buy that t-shirt? :) Dec 28, 2011 at 20:51
26

Okay, @maple_shaft's answer got me curious, so after about 20 minutes of Googling...

From one of the original HTML drafts:

NOTE: In the initial design for forms, multi-line text fields were supported by the Input element with TYPE=TEXT. Unfortunately, this causes problems for fields with long text values. SGML's default (Reference Quantity Set) limits the length of attribute literals to only 240 characters. The HTML 2.0 SGML declaration increases the limit to 1024 characters.

So no, it did not have to do with rows and cols being unique to textarea, like the accepted answer claims.

3
  • The currently accepted answer is decidedly not correct. The stackoverflow question linked to in grahamparks comment also has accurate answers (stackoverflow.com/questions/5637326/…). Jan 28, 2012 at 1:52
  • @Izkata Thanks for finding and posting this! Most people wouldn't have cared enough to revive an old question with new information.
    – maple_shaft
    Jan 29, 2012 at 22:54
  • @maple_shaft I've often wondered the same thing, though, but didn't really have an idea where to start searching. Got the idea from your answer (Plus this one isn't that old, I've posted new stuff to SciFi.SE for Star Trek after a year or more (^_~) )
    – Izkata
    Jan 29, 2012 at 23:30
7

To understand why the textarea is a unique tag compared to the other input fields you would have needed to be in the original message chains between Conolly and Berners-Lee in the years leading up to the release of the HTML 2.0 standard that came out in 1995. Why it is not a standard input tag like everything else may have been because of a technical difficulty at the time or some general compromise that they had agreed upon.

For the original HTML 2.0 specification on HTML Forms see here: https://www.rfc-editor.org/rfc/rfc1866#section-8

At one point someone had found the original AOL message boards and posted them publicly where they were going back and forth discussing the various prototypes that led up to HTML as we know it today. It was intensely interesting but I can't seem to find it anymore.

2
  • Hopefully someone can find it.
    – CaffGeek
    Dec 28, 2011 at 20:29
  • @Chad - I didn't find the messages, but see my just-posted answer
    – Izkata
    Jan 27, 2012 at 22:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.