Account
Categories

HTML Form Attributes


There are different types of attributes that you can use to control the behavior of HTML forms.

  • action

    When you use the action attribute in the <form> tag, it specifies the URL (server or page) to which the form is submitted.

    Syntax:

    <form action="URL">
    
  • method

    When you use the method attribute in the <form> tag, it specifies how the form data is sent (GET or POST).

    Syntax:

    <form method="GET">
    
  • name

    When you use the name attribute in the <form> tag, it gives a name to the form for identification.

    Syntax:

    <form name="myForm">
    
  • target

    When you use the target attribute in the <form> tag, it specifies where the response will open after form submission, such as in the same tab or in a new tab.

    Syntax:

    <form target="_blank">
    
  • autocomplete

    When you use the autocomplete attribute in the <form> tag, it allows the browser to fill in form fields automatically.

    Syntax:

    <form autocomplete="on">
    
  • enctype

    When you use the enctype attribute in the <form> tag, it specifies how the form data is encoded before sending it to the server.

    Syntax:

    <form enctype="multipart/form-data">
    
  • novalidate

    When you use the novalidate attribute in the <form> tag, it turns off form validation before submission.

    Syntax:

    <form novalidate>