Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="#">
    <title>Prevent form submission with specific email domains</title>
  <h1>Prevent form submission with specific email domains</h1>
    <p>Try to use one of the following email domains to submit the form:,,,</p>
    <div class="form-container">
        <form action="#" id="subscription_form">
                <input type="email" class="form" id="email" placeholder="">

                <input type="submit" id="submit" class="btn" role="button" />



                *, *::after, *::before {
    box-sizing: border-box;
    font-family: Gotham Rounded, sans-serif;

body {
    background: linear-gradient(to right, rgb(249 115 22), rgb(251 146 60));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;

h1 {
    color: #ffffff;
    text-align: center;

p {
    color: #ffffff;
    margin-bottom: 50px;

.form-container {
    width: 20%;

.form-container input[type="email"] {
    padding: 15px 6px;
    border: none;
    margin-bottom: 10px;
    width: 100%;

.form-container input[type="email"]:focus-visible {
    outline: none;

.form-container .btn {
    background-color: rgb(38 38 38);
    color: white;
    padding: 14px 35px;
    margin-bottom: 10px;
    border: none;
    transition: all .4s ease;
    cursor: pointer;

.form-container .btn:hover {
    background-color: rgb(71 85 105);


                const form = document.getElementById("subscription_form");
const emailField = document.getElementById("email");
const emailBlacklist = [

form.onsubmit = function(e){

    let emailDomain = emailField.value.indexOf("@");
    let emailVal = emailField.value.substring(emailDomain);
    let emailFound = false;
    let emailBlacklistLength = emailBlacklist.length;

    for(i=0; i < emailBlacklistLength; i++){

        if(emailVal == emailBlacklist[i]){ 
            emailFound = true;


        alert("Submission with this email domain is not allowed!");