Will Tuttle Will Tuttle - 2 months ago 8
HTML Question

how is this login form demo making the "please fill in field" popup?

I've been using a template I found for a login form at: http://codepen.io/bbodine1/pen/hflzK

<div class="container">
<section id="content">
<form action="">
<h1>Login Form</h1>
<input type="text" placeholder="Username" required="" id="username" />
<input type="password" placeholder="Password" required="" id="password" />
<input type="submit" value="Log in" />
<a href

="#">Lost your password?</a>
<a href="#">Register</a>
</form><!-- form -->
<div class="button">
<a href="#">Download source file</a>
</div><!-- button -->
</section><!-- content -->
</div><!-- container -->

It has a nifty popup next to any field left empty when submitting that says "Please fill out this field". I'd like to add this functionality to other custom forms I'm using but after looking through the html and css code, I can't find out how their triggering that popup.

Can anyone spot it?


enter image description here

As long as you're using HTML5 and the required property on your inputs this message will popup when you attempt to submit the form.

At the top of each HTML5 page you declare the doctype:

<!doctype html>


<!DOCTYPE html>

The for each required input use the required property:

<input name="userpass" placeholder="passphrase" type="password" value="" required />