Skip to content

Latest commit

 

History

History
67 lines (43 loc) · 2.09 KB

input_tag_property.md

File metadata and controls

67 lines (43 loc) · 2.09 KB

HTML <input> Tag Properties (Excluding type)

The <input> tag in HTML is used to create various form elements. Apart from the type attribute, it supports several other properties. Here's an overview:

Common Attributes:

  1. name Attribute:

    • Defines the name of the input element. Used when submitting form data.
  2. value Attribute:

    • Sets the initial value of the input.
  3. disabled Attribute:

    • Disables the input element, preventing user interaction.
  4. readonly Attribute:

    • Specifies that the input field is read-only.
  5. placeholder Attribute:

    • Provides a short hint that describes the expected input.
  6. autofocus Attribute:

    • Automatically focuses on the input element when the page loads.
  7. required Attribute:

    • Indicates that the input must be filled out before submitting the form.
  8. autocapitalize Attribute:

    • Controls capitalization of text.
  9. autocomplete Attribute:

    • Enables or disables browser auto-completion.
  10. autocorrect Attribute:

    • Controls automatic spelling correction.
  11. spellcheck Attribute:

    • Specifies whether the browser should check the spelling of the text.

Size and Appearance:

  1. size Attribute:

    • Specifies the visible width of the input, in characters.
  2. maxlength Attribute:

    • Defines the maximum number of characters allowed in the input.
  3. minlength Attribute:

    • Specifies the minimum number of characters required in the input.
  4. width and height Attributes:

    • Sets the width and height of the input element.

Styling:

  1. class Attribute:

    • Specifies one or more class names for styling.
  2. style Attribute:

    • Defines inline CSS styles for the input element.

JavaScript and Events:

  1. onclick, onchange, oninput, etc.:
    • Event attributes to execute JavaScript code on various events.

These properties enhance the functionality and appearance of the <input> element. Choose and customize them based on your specific form requirements and styling preferences.