Can you have text show up after input (HTML) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Can you have text show up after input (HTML)

Is there any way to have code(text) show up after you submit an input in HTML using HTML5 or javascript? For example, if you wanted "Thanks for submitting!" after you submitted an input, how would you?

28th Sep 2018, 8:38 PM
Tyler
Tyler - avatar
4 Answers
+ 10
yeah you can. you can learn about it in Javascript & php . copy paste this code to see : <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <form> <input type="text" placeholder="text" id="input" autofocus required/> <button type="button" id="sub" onclick="go()""> submit </button> </form> <p id="p"></p> <!--javascript--> <script> function go(){ var output= document.getElementById("p"); output.innerHTML= "thank you for submission !" } </script> </body> </html>
28th Sep 2018, 9:06 PM
Armann
Armann - avatar
+ 7
becuse help you this code with jquery 😞 <input type="text" id="txt"> <p></p> <input type="submit" id="btn"> <!--j query--> <script> $("#btn").click (function(){ var txt=$("txt").val (); $("p").html=txt; }); </script>
28th Sep 2018, 9:22 PM
hossein Soltanian
hossein Soltanian - avatar
+ 7
Tyler you're welcome.
28th Sep 2018, 9:26 PM
Armann
Armann - avatar
+ 4
Thanks!
28th Sep 2018, 9:20 PM
Tyler
Tyler - avatar