Which Html Tag Is Used to Embed the Javascript Code
HTML <input> tag
Updated: 11/13/2018 by Computer Hope
When writing in HTML, the <input> tag is an inline element used to create both input fields and interactive controls for web-based forms. Nested within a <form> tag, they are useful for allowing the acceptance of user-input data of various types on a website. The following sections contain information about the <input> tag, including an example of it in use, and related attributes and browser compatibility.
Note
The <input> tag belongs to a group of tags called form elements.
- Example of <input> code
- Example result
- Attributes
- Deprecated attributes
- Compatibility
- Additional form elements
- Related pages
Example of <input> code
<form action="script name" method="get">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit" value="Submit">
</form>
Note
The "script name" in the action attribute should be changed to the name and location of your script file. For example, it could be changed to an ASP, Perl, PHP, or Python script file.
Example result
Note
The above example returns you to this page because nothing is used for the action. If you want a working example of the form tag, you can use our search engine found at the top and bottom of every page. For example, enter any computer term in the search to get an immediate definition of that term.
Attributes
Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all the current unique HTML attributes for the <input> tag, and a description of each.
Attribute | Description |
---|---|
accept | Designates the files types that a server accepts (only used for type="file"). |
alt | Designates an alternate text for images (only used for type="image"). |
autocomplete | Toggles the autocomplete function. |
autofocus | Designates that an <input> element should be the first thing focused when the page loads. |
checked | Designates that an <input> element should be pre-selected when the page loads (for type="checkbox" or type="radio"). |
disabled | Designates that the <input> element is disabled. |
form | Designates the form(s) of where an <input> element belongs. |
formaction | Designates the URL of the file that will process the submitted form data (for type="submit" and type="image"). |
formenctype | Designates how the form data should be encoded upon submission (for type="submit" and type="image"). |
formmethod | Designates the HTTP method to be used when sending data to the formaction URL (for type="submit" and type="image"). |
formnovalidate | Designates that form data should not be validated upon submission. |
formtarget | Designates where to display the response to submitted data (for type="submit" and type="image"). |
height | Designates the height of the <input> element. |
list | Points to a <datalist> element containing options for the <input> element. |
max | Designates the max value of an <input> element. |
maxlength | Designates the max number of characters allowed in an <input> element. |
min | Designates the minimum value of an <input> element. |
multiple | Designates that a user can enter multiple values in an <input> element. |
name | Designates a name for the <input> element. |
pattern | Designates a regular expression that an <input> element's value is used to check. |
placeholder | Designates a message that describes the expected value of an <input> element. |
readonly | Designates that an <input> element is read-only. |
required | Designates that an input field must be filled out before form submission. |
size | Designates how many characters wide an <input> element is. |
src | Designates the URL of the image to use as a submit button. |
step | Designates the allowed number intervals for an input field. |
type | Designates the type of <input> element to display. |
value | Designates the value of an <input> element. |
width | Designates the width of an <input> element. |
Deprecated attributes
A deprecated attribute is one that may function currently but is not supported in going forward. While the attribute may work with the current version of HTML, it will eventually be phased out. It is better to avoid using these attributes to help future-proof your website.
Attribute | Description |
---|---|
align | Designates the alignment of the <input> element with respect to the content around it. |
Compatibility
Edge | Internet Explorer | Firefox | Safari | Opera | Chrome |
---|---|---|---|---|---|
All versions | All versions | All versions | All version | All versions | All versions |
Additional form elements
- <button>
- <datalist>
- <fieldset>
- <keygen>
- <label>
- <legend>
- <optgroup>
- <option>
- <output>
- <select>
- <textarea>
Autocomplete, Browser, Compatibility, HTML datalist tag, HTTP, Nesting, Read-only, Regular expression, URL, Web design terms
Which Html Tag Is Used to Embed the Javascript Code
Source: https://www.computerhope.com/jargon/h/html-input-tag.htm
0 Response to "Which Html Tag Is Used to Embed the Javascript Code"
Post a Comment