Home > Article > Web Front-end > How to add the values of HTML elements?
This article will teach you how to add the value of an element in HTML. We have a basic understanding of the value attribute in HTML and the situations in which it is used. Let's look forward to a better understanding of the HTML value attribute.
In HTML, the value attribute is used to describe the value of the element with which it is used. It has different meanings for various HTML components. Usage - It can be used with ,
It has different meanings for various types of input:
It specifies the text on the button when it appears in "button," "reset," and "submit".
It specifies the initial value of the input field when it appears in the "text", "password" and "hidden" values.
When "checkbox", "radio" and "picture" are present, it represents the value associated with the input.
Clickable buttons are defined in HTML by the
<!DOCTYPE html> <html> <body> <form action="#" method="get"> Choose The Subject: <button name="subject" type="submit" value="HTML">HTML</button> <button name="subject" type="submit" value="java">JAVA</button> </form> </body> </html>
tag specifies a field for user input data. The most important form element is the element. The element can be rendered in many different ways, depending on the type attribute.
Consider the following example where we use an HTML form with tags with default values
<!DOCTYPE html> <html> <body> <form action="#"> <label for="firstname">FIRST NAME:</label> <input type="text" id="firstname" name="firstname" value="TUTORIALS"><br><br> <label for="lastname">LAST NAME:</label> <input type="text" id="lastname" name="lastname" value="POINT"><br><br> <input type="submit" value="Submit"> </form> </body> </html>
When you run the above script, it will generate an output that includes an input field using the value attribute to display the first and last name default values and a submit button on the web page.
List items are defined using the
The above is the detailed content of How to add the values of HTML elements?. For more information, please follow other related articles on the PHP Chinese website!