Javascript Course

There are many types of HTML form elements for different types of data that can be added or selected by the user.
- See the HTML tutorials: Forms and Input, and New Form elements and attributes in HTML5.

Accessing elements of <form> in JavaScript

There are several ways to access elements of a <form> in JavaScript.
Generally, these methods are used: getElementById(), querySelector(), the syntax: eform['elm_name'], or the eform.elements[index] property.

Forms elements have specific properties and methods that can be used in JavaScript to interact with the user.
- There is a list with useful properties and methods of the elements from <form> at the page:

Daily Test with Code Example

Which attribute is used in <a> tag for the address of the link?
src href rel
<a href="" title=""></a>
Which CSS property sets the type of the text font?
font-family text-decoration font-size
h2 {
What instruction selects all the <div> tags with class="cls"?
querySelector("div.cls") getElementsByTagName("div") querySelectorAll("div.cls")
var elm_list = document.querySelectorAll("div.cls");
var nr_elms = elm_list.length;       // number of selected items
Indicate the function that can be used to get the sum of values in an array.
array_sum() array_diff() array_shift()
$arr =[1, 2, 3, 4);
$arr_sum = array_sum($arr);
echo $arr_sum;       // 10
Accessing form fields

Last accessed pages

  1. Detect when ScrollBar reaches the bottom of the page (3452)
  2. innerHTML in PHP (12019)
  3. Diamond shape with CSS (2833)
  4. Get Attribute (ID, Class, Name, Title, Src) with jQuery (69888)
  5. Get the value of the selected /checked checkboxes in a form (43649)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (813)
  2. SHA256 Encrypt hash in JavaScript (734)
  3. Create simple Website with PHP (690)
  4. Read Excel file data in PHP - PhpExcelReader (689)
  5. PHP Unzipper - Extract Zip, Rar Archives (684)