html tutorial - method Attribute in HTML - html5 - html code - html form




  • The method attribute defines how to send the form-data.
  • The form-data is sent to the target page that can be defined in the action attribute.
  • The form-data will be sent as HTTP post transaction (with method="post") or as URL variables (with method="get").

Syntax for method attribute in HTML:

<form method=”get”>

Applies To:

Elements Attribute
<form> method

Sample Coding for method Attribute in HTML:

<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy method attribute</title>
    </head>
    <body>
         <form action="method.html" method="get">
         <input type="text" name="txtname">  <br>
         <input type="submit" value="submit">
         </form>
        </body>
</html>

Code Explanation for method Attribute in HTML:

 method Attribute Code Explanation

  1. <form> tag is used to design a form for user input.
  2. method attribute is used to send the form data to the URL using get method.

Output for method Attribute in HTML:

 method Attribute Tag Output

  1. Enter the text wikitechy in the text area.
  2. Click the submit button.
  3. After clicking the submit button, it will redirect to the same page and the name(txtname=wikitechy) has been displayed in the address bar.

Browser Support for method Attribute in HTML:

yes yes yes Yes Yes

Related Searches to method Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×