• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Programming Expert

Solving All of Your Programming Headaches

  • HTML
  • JavaScript
  • jQuery
  • PHP
  • Python
  • SAS
  • Ruby
  • About
You are here: Home / HTML / What is the Correct HTML for Making a Text Area?

What is the Correct HTML for Making a Text Area?

March 14, 2022 Leave a Comment

The correct HTML for making a text area element is just to use the HTML textarea tag.

<textarea>This is some text in the textarea element.</textarea>

Let’s take a look at the text area element in a form.


Let’s say I have the following HTML form:

<form>
  <label for="description">Description:</label>
  <textarea id="description" name="description"></textarea>
  <button type="submit" value="Submit">Submit</button>
</form>

As you can see in the code above, we have a simple text area element in our form. We usually want a label to go with the text area element to help describe what the user should input into the textarea. In the example above, we would expect the user to write a description about themselves.

Let’s take a look at a quick text area example below.

Example of the Correct HTML for a Text Area Element in a Form

In this simple example, we will just have a standard HTML form. We will provide the HTML code for it and let the user enter a name and description, and submit the form. The form will not have any backend connected to it, so when you submit the form, it should just refresh the page and put the variables you entered in the url.

<form>
  <label for="fname">What is Your Name?</label>
  <input type="text" id="fname" name="fname">
  <label for="description">Description:</label>
  <textarea id="description" name="description" placeholder="Give us a quick introduction of yourself"></textarea>
  <button type="submit" value="Submit">Submit</button>
</form>

And finally, here is the above code in action for you to try out.






Hopefully this article has been useful for you to understand what the correct HTML for making a text area element is.

Other Articles You'll Also Like:

  • 1.  How to Call a JavaScript Function From HTML
  • 2.  What Type of HTML List will Automatically Place a Number in Front of the Items?
  • 3.  innerHTML vs outerHTML
  • 4.  Can a div Have Two ids?
  • 5.  HTML subscript – How to Lower Text in HTML
  • 6.  What is the Correct HTML for Inserting a Background Image?
  • 7.  How Do You Select All p Elements Inside a Div Element?
  • 8.  What is the Correct HTML for Making a Text Input Field?
  • 9.  How to Give a Textarea a Max Length
  • 10.  How to Make a Div Scrollable in HTML

About The Programming Expert

The Programming Expert is a compilation of a programmer’s findings in the world of software development, website creation, and automation of processes.

Programming allows us to create amazing applications which make our work more efficient, repeatable and accurate.

At the end of the day, we want to be able to just push a button and let the code do it’s magic.

You can read more about us on our about page.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About The Programming Expert

the programming expert main image

Welcome to The Programming Expert. We are a group of US-based programming professionals who have helped companies build, maintain, and improve everything from simple websites to large-scale projects.

We built The Programming Expert to help you solve your programming problems with useful coding methods and functions in various programming languages.

Search

Learn Coding from Experts on Udemy

Looking to boost your skills and learn how to become a programming expert?

Check out the links below to view Udemy courses for learning to program in the following languages:

Copyright © 2023 · The Programming Expert · About · Privacy Policy