Form method attribute

Definition and usage

method Attribute setting or returning the value of the method attribute in the form.

HTML method attribute specifies how form-data is sent (form-data is sent to the page specified by the action attribute).

See also:

HTML reference manual:HTML <form> attribute ng method

Instance

Example 1

Change the method used to send form data:

document.getElementById("myForm").method = "post";

Try it yourself

Example 2

Return the method used to send form data:

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

Try it yourself

Syntax

Return method attribute:

formObject.method

Set method attribute:

formObject.method = get|post

Attribute value

Value Description
get Attach form data to URL: URL?name=value&name=value (default).
post Send form data as an HTTP POST transaction.

Technical details

Return value: String value, represents the HTTP method used to submit the form ("get" or "post").

Suporta ng Browser

Ang mga numero sa talahanayan ay naglalarawan ng unang bersyon ng browser na ganap na sumusuporta sa katangian na iyon.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Suporta Suporta Suporta Suporta Suporta

Komentaryo:Kung hindi tinukoy ang attribute ng method (default), ang Chrome, Internet Explorer/Edge, Firefox at Opera ay magbibigay ng "get", at ang Safari ay hindi nagbibigay ng anumang nilalaman.