HTMLFormElement: method property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("HTML DOM")}}
The **HTMLFormElement.method** property represents the {{Glossary("HTTP")}} method used to submit the {{HtmlElement("form")}}.
Unless explicitly specified, the default method is 'get'.
Value
A string.
Examples
js
document.forms["my-form"].method = "post";
const formElement = document.createElement("form"); // Create a form
document.body.appendChild(formElement);
console.log(formElement.method); // 'get'Specifications
{{Specifications}}
Browser compatibility
{{Compat}}