How to Get $user_input from <button> in html and input that in form Or anything else ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How to Get $user_input from <button> in html and input that in form Or anything else ?

17th Jan 2019, 4:01 AM
[SE]شبگرد
[SE]شبگرد - avatar
8 Answers
+ 6
<!doctype html> <html> <head> <script> function getUser(){ alert(document.getElementById("user"). value); } </script> </head> <body> <Input id="user" type="text"/> <button onClick="getUser()">Alert</button> </body> </html>
17th Jan 2019, 6:35 AM
Kelvin Paul
Kelvin Paul - avatar
+ 5
Mikael W-Dox, if you know how to from pHp and javascript then ypu probably know such task can be done by html
18th Jan 2019, 4:36 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 4
Kelvin Paul no , i ask for html , i know java and php can do this .
17th Jan 2019, 6:29 AM
[SE]شبگرد
[SE]شبگرد - avatar
+ 4
yes
17th Jan 2019, 6:32 AM
[SE]شبگرد
[SE]شبگرد - avatar
+ 4
Kelvin Paul ok thanks
17th Jan 2019, 6:33 AM
[SE]شبگرد
[SE]شبگرد - avatar
+ 2
Did you mean using either php or JavaScript?
17th Jan 2019, 6:27 AM
Kelvin Paul
Kelvin Paul - avatar
+ 2
Did you mean get user input using <input> tag with the help of button tag
17th Jan 2019, 6:30 AM
Kelvin Paul
Kelvin Paul - avatar
+ 2
Please use JavaScript
17th Jan 2019, 6:32 AM
Kelvin Paul
Kelvin Paul - avatar