Testadmin
Testadmin

Reputation: 2898

Input type text field become a multiline in Html

i want a text box in my html page , But i would like to it become a multi line text box . Is it possible in html ? i don't want to use Textarea ,,

Upvotes: 1

Views: 5952

Answers (3)

Brian Scott
Brian Scott

Reputation: 9361

One thing to consider is that in order for your site to be wcag compliant it should function correctly with JavaScript disabled. This might be an issue concerning the textArea jquery swap approach.

The textarea is to all intents a multiline textbox. The only difference being that it doesn't have a max length property which can be taken care of with a server side validation anyway.

Can you provide more detail on why you cannot use the textarea and perhaps you will get a more suitable answer?

Upvotes: 0

Peter O
Peter O

Reputation: 599

<textarea></textarea>

See here for details: http://www.w3schools.com/TAGS/tag_textarea.asp

-- Edit: Oh sorry, you meant a text input. In that case, as responded in the other answer: no, you can't make it multiline but you can swap it for a textarea.

Upvotes: 0

Sampson
Sampson

Reputation: 268354

You can use the TEXTAREA tag:

<textarea>This is a multi-line box</textarea>

You could use jQuery to replace a textbox with a textarea:

$(".swap").click(function(){
  var textArea = $("<textarea></textarea>");
  var textBox  = $(":text[name='message']");
  $(textBox).replaceWith(textArea);
});

Upvotes: 2

Related Questions