Code
Execute
<!DOCTYPE html> <html> <head> <title>html tutorial - html5 - html code - html form - In 30Sec by Microsoft Award MVP - | wikitechy required attribute</title> </head> <body> <form action="#" onsubmit="alert('Submitted!');return false;"> <input type="text" name="username" required> <input type="submit"> </form> </body> </html>
Result