Reveal Submit Button When Email is Validated

</ head>

</ body>

<!-- REVEAL SUBMIT BUTTON WHEN EMAIL IS VALIDATED --> 
<script>
  $(function(){

    // Only show submit button on proper email
    ;( function( $, window, document, undefined ) {
        'use strict';
        var form        = '.email-form',
            className   = 'email-active',
            submit      = 'input[type="submit"]',
            email       = 'input[type="email"]';
        $( form ).each( function(){
            var $form   = $( this ),
                $email  = $form.find( email ),
                $submit  = $form.find( submit ),
                val     = '';
            $email.on( 'keyup.addClassWhenEmail', function(){
                val = $email.val();
                $submit.toggleClass( className, val != '' && /^([\w-\.]+@([\w-]+\.)+[\w-]{2,12})?$/.test( val ) );    
            });
        });
    })( jQuery, window, document );
  })
</script>

HTML/Embed

Only tabs with a " " have code.
<!-- REVEAL SUBMIT BUTTON WHEN EMAIL IS VALIDATED --> 
<script>
  $(function(){

    // Only show submit button on proper email
    ;( function( $, window, document, undefined ) {
        'use strict';
        var form        = '.email-form',
            className   = 'email-active',
            submit      = 'input[type="submit"]',
            email       = 'input[type="email"]';
        $( form ).each( function(){
            var $form   = $( this ),
                $email  = $form.find( email ),
                $submit  = $form.find( submit ),
                val     = '';
            $email.on( 'keyup.addClassWhenEmail', function(){
                val = $email.val();
                $submit.toggleClass( className, val != '' && /^([\w-\.]+@([\w-]+\.)+[\w-]{2,12})?$/.test( val ) );    
            });
        });
    })( jQuery, window, document );
  })
</script>
Only tabs with a " " have code.
Only tabs with a " " have code.
Only tabs with a " " have code.
If you have already pasted this code into your project then you can skip this. If you haven't, and it's your first time using CodeCrumbs, then copy this code and navigate to your sites global settings > Custom Code tab > paste it into the <head> (first custom code block). It just needs to exist once.
Author
N/A
Updated on
May 8, 2024

How to use:

Unlock more with PRO

Want to learn how to use this Crumb? Unlock detailed documentation, video tutorials, comments & support!

Upgrade to Pro

Unlock more with PRO

Want to learn how to use this Crumb? Unlock detailed documentation, video tutorials, comments & support!

Upgrade to Pro
Tutorial Coming Soon!

Check Browser Support

Interactive Table

This awesome code crumb will hide the submit button on any form until the email is validated in the email input field. Adds a really nice visual experience.

Clone Project
Documentation
Author:
Status:
Deprecated
New
Updated
Latest Version:
Built by
Built with
For the best experience

Please switch to desktop to view the content.

Back Home
Thank you! Your submission has been received!
Close Form
Oops! Something went wrong while submitting the form.
Become a Contributor