How i can get this words "username" "password" written in its boxes and disappear when the user write his data in the boxes ?! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How i can get this words "username" "password" written in its boxes and disappear when the user write his data in the boxes ?!

1st Feb 2017, 4:19 PM
Hosam Mohamed
Hosam Mohamed - avatar
7 Answers
+ 4
Simple using placeholder attribute in input tag see this code..... <html> <head> <title>Placeholder</title> <head> <body> <form action="#" method="post"> <input type="text" name="username" placeholder="Username" required="yes"></input> <input type="password" name="password" placeholder="password" required="yes"></input> <input type="submit"></input> </form </body> </html>
1st Feb 2017, 4:42 PM
Avnish Tomar (CCS University)
Avnish Tomar (CCS University) - avatar
+ 1
Look it up in w3 schools. Plenty of information there if you are not familiar with the syntax. Search html forms and it should pop up.
1st Feb 2017, 4:34 PM
Nikolai Russev
Nikolai Russev - avatar
+ 1
use placehoder. <html> <head>title="name the form here"</head> <body> <form action="www.example.com" method="post"> <input type="text" name="username" placeholder="username"></input> <input type="submit"></input> </form> </body> </html>
1st Feb 2017, 5:54 PM
prayoga
prayoga - avatar
0
@Nikolai Russev if i use value, i found the form was filled with the value you have made.
1st Feb 2017, 6:00 PM
prayoga
prayoga - avatar
0
Just use the placeholder attribute. For example: <html> <head> </head> <body> <form> <input type="username" name="username" PLACEHOLDER="username"> <input type="password" name="password" PLACEHOLDER="password"> <input type="submit" onclick="<Interactivity here>"> </form> </body> </html>
1st Feb 2017, 6:23 PM
ΣVlαdΣ
ΣVlαdΣ - avatar
- 1
i cant get it ? explain more please u didnt add any difference !!
1st Feb 2017, 4:32 PM
Hosam Mohamed
Hosam Mohamed - avatar
- 5
Use the value keyword inside the tag. Example: <input type="text" value="username">
1st Feb 2017, 4:29 PM
Nikolai Russev
Nikolai Russev - avatar