xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create a form in an HTML page
HTML Online Editor
Run Code
More HTML Sample Codes
<!DOCTYPE html> <html> <head> <title>Form in HTML Page</title> <!-- Title of the page--> </head> <body> <h1>Example of Form in a Webpage</h1> <hr /> <h3>This is an HTML form.</h3> <p>Write your name in the textbox and click the "Submit Name" button to see the effect.</p> <!--<form> tag is used to create a form. --> <form> <label>Your Name:</label><input type="text" id="myText" /> <!--<input> is used to create submit button defining type as "submit". --> <input type="submit" id="btnSubmit" value="Submit Name" /> </form> <p><form> tag is used to create an HTML form. HTML form is used to submit data. </p> <script> var btnSubmit = document.querySelector("#btnSubmit"); btnSubmit.addEventListener('click', function (e) { e.preventDefault(); var name = document.querySelector("#myText").value; alert("You have submitted your name as " + name); }) </script> </body> </html>