Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • HTML Tutorial
  • HTML Exercises
  • HTML Tags
  • HTML Attributes
  • Global Attributes
  • Event Attributes
  • HTML Interview Questions
  • HTML DOM
  • DOM Audio/Video
  • HTML 5
  • HTML Examples
  • Color Picker
  • A to Z Guide
  • HTML Formatter
Open In App
Next Article:
How to specify the width of an input element in HTML5 ?
Next article icon

How to specify the value of an input element using HTML ?

Last Updated : 25 Dec, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we will set the value of an input element using HTML. The value attribute for <input> element in HTML is used to specify the initial value of the input element. It has different meaning for different input type:

  • The “button”, “reset” and “submit” property specifies the text on the button.
  • The “text”, “password” and “hidden” property specifies the initial value of the input field.
  • The “checkbox”, “radio” and “image” property specifies the value associated with the input.

Syntax:

<input value = "value">

Attribute Value: It contains single value text which specifies the value of input element.

Example 1:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to specify the value of an
        input element using HTML?
    </title>
</head>
  
<body style="text-align:center">
  
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
  
    <h2>
        How to specify the value of an
        input element using HTML?
    </h2>
  
    Input Value: <input type="text" 
        value="GeeksforGeeks">
</body>
  
</html>
 
 

Output:

Example 2:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to specify the value of an
        input element using HTML?
    </title>
</head>
  
<body style="text-align:center">
  
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
  
    <h2>
        How to specify the value of an
        input element using HTML?
    </h2>
  
    <input type="button" value="Submit">
</body>
  
</html>
 
 

Output:



Next Article
How to specify the width of an input element in HTML5 ?

V

vkash8574
Improve
Article Tags :
  • HTML
  • Web Technologies
  • HTML-Questions

Similar Reads

  • How to specify the type of an input element using HTML ?
    In this article, we will specify the type of an input element using HTML. The HTML <input> type attribute is used to specify the type of <input> element to display. The default type of <input> type attribute is text. Syntax: <input type="value"> Attribute Values: button: It i
    4 min read
  • How to specify the width of an input element in HTML5 ?
    We'll focus on how to set the width of input elements in a user-friendly and straightforward manner. To control the width of input elements like text fields, we can either use the size attribute (for text-based inputs) or apply custom styles using CSS (to define the width property). Let's start by c
    2 min read
  • How to set a value to an input file using HTML?
    In HTML, we will use the type attribute to take input in a form and when we have to take the file as an input, the file value of the type attribute allows us to define an element for the file uploads. It displays a browse button on our computer screen, and when we click on it, it asks the user for p
    2 min read
  • How to specify the name of an input element?
    To add the name of an input element, we use the HTML <input> name attribute. The HTML <input> name attribute is used to specify a name for an <input> element. It is used to reference the form data after submitting the form or to reference the element in JavaScript. Syntax:<input
    2 min read
  • How to specify a short hint that describes the expected value of an input element using HTML ?
    The placeholder attribute specifies a short hint for input field that describes the expected value of an input field/text area. The short hint is displayed in the field before the user enters a value. Syntax: <element placeholder="value"> Attribute Value: This attribute describes the short hin
    1 min read
  • How to specify a name for the output element in HTML?
    The name attribute specifies the name of an <output> element. It is used to reference form data after it has been submitted, or to reference the element in JavaScript. The <output> tag is used to represent the result of a calculation. The HTML <for> type attribute is used because i
    1 min read
  • How to specify a name for the fieldset using HTML ?
    The <fieldset> tag in HTML5 is used to make a group of related elements in the form and it creates the box over the elements. The <fieldset> tag is new in HTML5. The HTML <fieldset> name attribute is used to specify the name for the fieldset element. It is used to reference the for
    1 min read
  • How to Get the Value of an Input Text Box using jQuery?
    When working with forms or interactive web pages, sometimes need to get the values entered into the input fields. This article provide a complete guide on how to get the value o an input text box using jQuery. Below are the different approaches to get the value of an input text box using jQuery: Get
    2 min read
  • How to specify that a user can enter more than one value in an input element in HTML5?
    The multiple attribute is used to specify whether the user can enter more than one value in an input element. It is a Boolean attribute. When set to true, the input element can accept more than one value. The multiple properties can be used in the following ways. With the <input> tag only the
    2 min read
  • How to pre-select an input element when the page loads in HTML5?
    In this article, we are going to pre-select an input element when the page loads i.e. the user doesn't have to click the first text box to start writing on it. When the page is loaded the input is to be pre-selected and the user can start typing directly. This can be done by using the autofocus attr
    1 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences