How does JavaScript work in HTML Tags to Alert or Prompt in a <form> or <input /> submit or verify button? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How does JavaScript work in HTML Tags to Alert or Prompt in a <form> or <input /> submit or verify button?

This is a newbie question! I've been learning HTML and JavaScript for a while, but I have not been applying the knowledge coding. Question: How can I apply JavaScript to HTML code? for example the <form> and <input /> Tag, Let's say I want to alert "Thank you!" after the person Clicks on "Submit" or "Verify" it should alert ( "Thank You!"). How can I go about it? Thanks for you answers...

7th May 2017, 7:36 AM
Elvis Ngboki
Elvis Ngboki - avatar
2 Answers
+ 14
With minimal code ( require to be completed ): <form> <input type="submit" onclick="alert('thank you!');"> </form>
7th May 2017, 8:36 AM
visph
visph - avatar
+ 2
Thanks a lot @visph
9th May 2017, 12:05 AM
Elvis Ngboki
Elvis Ngboki - avatar