WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML DOM Form Object


Form Object

The Form object speaks to a HTML <form> element.

Access a Form Object

You can get to a <form> component by utilizing getElementById():

var x = document.getElementById("myForm");

Tip: You can likewise get to a <form> component by utilizing the forms collection.

Create a Form Object

You can make a <form> component by utilizing the document.createElement() method:

var x = document.createElement("FORM");

Form Object Collections

Collection Description
elements Returns an accumulation of all components in a form

Form Object Properties

= Property included HTML5.

Property Description
acceptCharset Sets or returns the estimation of the acknowledge charset property in a form
action Sets or returns the estimation of the activity trait in a form
autocomplete Sets or returns the estimation of the autocomplete quality in a form
encoding Alias of enctype
enctype Sets or returns the estimation of the enctype quality in a form
length Returns the quantity of components in a form
method Sets or returns the estimation of the strategy trait in a form
name Sets or returns the estimation of the name quality in a form
noValidate Sets or returns whether the structure information ought to be approved or not, on submission
target Sets or returns the estimation of the objective trait in a form

Form Object Methods

Method Description
reset() Resets a form
submit() Submits a form

Form Object Events

Event The occasion happens when...
onreset The reset catch is clicked
onsubmit The submit catch is clicked

Standard Properties and Events

The Form object likewise underpins the standard properties and events.