View on GitHub

code-201-reading-notes

Forms

what is the forms?

we use forms to get the informations from the user

-The best known form on the web is probably the search box that sits right in the middle of Google’s homepage.

Form Controls

There are several types of form controls that you can use to collect information from visitors to your site.

  1. ADDING TEXT :(Text input, Password input, Text area)
  2. Making Choices :(Radio buttons, Checkboxes, Drop-down boxes)
  3. Submitting Forms :(Submit buttons, Image buttons)
  4. Uploading Files :(File upload)

How Forms Work :

img

Form Structure :

use <form> tag as parent for forms controls inside, and it takes action as attrbute and method (witch has one of two methods: ‘get or post’) and id att..

  1. Text Input : witch uses <input> tag and have type="text", name, maxlength, size as attrbuts

  2. Password Input : witch uses <input> tag and have type="password", name, maxlength, size as attrbuts

  3. Text Area : witch uses <textarea> tag

  4. Radio Button : witch uses <input> tag and have type="radio", name, value, checked as attrbuts
  5. Checkbox : witch uses <input> tag and have type="checkbox", name, value, checked as attrbuts

The HTML < form> Elements

The HTML < form> element can contain one or more of the following form elements:

so Whenever you want to collect information from

visitors you will need a form, which lives inside a ‘<form>’ element.

Each form control is given a name, and the text the

user types in or the values of the options they select are sent to the server.

Lists, Tables and Forms

Tables

using the following:

Events

browser registers different types of events javaScript then respond to these events.

Events are the browser’s way of indicating when something has happened

(such as when a page has finished loading or a button has been clicked).

When an event occurs on an element??

Binding is the process of stating which event you are waiting to happen, and which element you are waiting for that event to happen upon. (3 ways for binding)

event delegation to monitor for events that happen on all of the children of an element.

Event FLow The order of how events fire . directions of event flow :

  1. inwards : event capturing
  2. outwards : event bubbling
  1. The addEventListener() method attaches an event handler to an element without overwriting existing event handlers.

  2. element.addEventListener(event, function, useCapture);

The removeEventListener() method The removeEventListener() method removes event handlers that have been attached with the addEventListener() method