SheTech
  • SheTech JS bootcamp
  • Level 1 - awesome tasks
    • Introduction to Awesome Tasks
    • Step 1: HTML
    • Step 2: playing with the DOM
    • Step 3: add a new task
    • Step 4: dynamic list of tasks
    • Step 5: adding new items
    • Step 6: removing items
    • Step 7: add some style
    • Step 8: marking items as done
    • Step 9: saving items in the localstorage
    • Step 10: adding filters and bulk actions
    • Step 11: add counters
    • From Awesome Task to the next big thing!
  • Level 2 - timeline
    • Live Timeline
    • Step 1: basic HTML page
    • Step 2: add util library
    • Step 3: show all posts
    • Step 4: add form
    • Step 5: collect form data
    • Step 6: create a new post
    • Step 7: validating posts
    • Step 8: refactoring
    • Step 9: refresh button
    • Step 10: auto refresh
  • Code Editors
  • Useful resources
  • API Reference
  • Glossary
Powered by GitBook
On this page

Was this helpful?

  1. Level 2 - timeline

Step 4: add form

PreviousStep 3: show all postsNextStep 5: collect form data

Last updated 4 years ago

Was this helpful?

After div#posts add

<hr />
<form id="post-form">
  <div class="form-group">
    <label for="post-title" class="control-label">Post Title</label>
    <input type="text" class="form-control" id="post-title" placeholder="A new post" />
  </div>
  <div class="form-group">
    <label for="post-body" class="control-label">Post Content</label>
    <textarea type="text" class="form-control" id="post-body" placeholder="A new Body"></textarea>
  </div>
  <button type="submit" class="btn btn-primary">Post</button>
</form>

What does this code do?

We are adding a form to let the user write and post a new message.

A form is a powerful tool that allows users to interact with the website interface through its components (such as text areas, option fields and so on). Once a form is submitted, its content is sent to a server where it can processed.

Usually an HTML form contains other control element like input or textarea that can used to insert any kind of text.

What we just did:

  • We used a form to let our users write and post new messages.

Form implements some css classes from to appear more pleasant!

What is a <form>?
Boostrap