HTML

How to insert a tip for the user in the input text with HTML

November 5, 2021

How to insert a tip for the user in the input text with HTML

In this article, we’ll learn how to insert a tip for the user in the input, so he can understand what he needs to fill in the field.

insert a tip for the user in the input cover

Hey you programmer, okay? Let’s learn something new!

Well, to solve the tip problem in the form we have a very simple and useful feature

Let’s insert an attribute in the desired input, this attribute is called placeholder

And in the placeholder we have to insert a value, which is the tip we’ll give the user to fill in the field correctly

How to insert a tip for the user in the input: in practice!

Let’s see it in the code how to apply this attribute:

<!DOCTYPE html>
<html>
 <head>
  <title>Como inserir uma dica para o usuário no input</title>
 </head>
 <body>
  <form>
   <input type="text" name="name" placeholder="Insira o seu nome">
   <input type="email" name="email" placeholder="Insira seu e-mail">
   <input type="submit" value="Enviar">
  </form>
 </body>
</html>

Now see what is displayed in the browser:

html form tips example

We can see that in the name and email inputs, we insert the placeholder attribute

Inside we write tips for the user to guide themselves and send the form correctly to the backend

We then solved our problem! Cool, isn’t it? 😀

Conclusion

We learned how to insert a tip for the user via input with the placeholder attribute

This is very important because sometimes we need to give more accurate information than we want from the user

Making the application fulfill its purpose and the user to send the data correctly

And that’s it for today, see you on the next post! 🙂

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x