cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

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.

            
              <div id='centerBtn'>
  <a href='#' class='login button success small'>Login</a>
</div>
            
          
!
            
              #centerBtn
{
  text-align: center;
}

.login
{
  margin-top: 80px !important;
}
            
          
!
            
              $(function(){
  
/* Attach login handler */
$('.login').on('click', function(e){
	
	e.preventDefault();
	
	/* Popup an alert with the form */
	$.jAlert({
		'title': 'Login',
		'content': '<form>Email:<br><input type="email" name="email">Password:<br><input type="password" name="password"><a href="#" class="forgotPassword">forgot my password</a></form>',
    'theme': 'blue',
		'onOpen': function(alert){
			alert.find('form').on('submit', function(e){
				e.preventDefault();
			});
      alert.find('.forgotPassword').on('click', function(e){
        alert.closeAlert();
        $.jAlert({
          'title': 'Forgot my password',
          'content': '<form>Enter your email to be sent a temporary password:<br><input type="email" name="email"></form>',
          'autofocus': 'input[name="email"]',
          'btns': 
          [
              {
                'text': 'send',
                'theme': 'green',
                'onClick': function(e, btn){
                  //send to server, validate email address, send email
                  successAlert('Sent!');
                  }
              },
              {
                'text': 'login',
                'theme': 'blue',
                'onClick': function(e, btn){
                  btn.parents('.jAlert').closeAlert();
                  $('.login').click();
                }
              },
              {
                'text': 'close'
              }
            ]
        });
      });
		},
		'autofocus': 'input[name="email"]',
		'btns': [
			/* Add a save button */
			{ 'text': 'login', 'theme': 'green', 'closeAlert': false,         'onClick': function(e){
				
            e.preventDefault();

            var btn = $('#'+this.id),
              alert = btn.parents('.jAlert'),
              form = alert.find('form'),
              email = form.find('input[name="email"]').val(),
              pass = form.find('input[name="password"]').val();

            /* Verify required fields, validate data */
            if( typeof email == 'undefined' || email == '' )
            {
              errorAlert('Please enter your email address!');
              return;
            }
            if( typeof pass == 'undefined' || pass == '' )
            {
              errorAlert('Please enter your password!');
              return;
            }

            //make call to server with form.serialize() and verify the user exists
            //var response = { success: false, msg: 'Error, incorrect credentials' };
            var response = { success: true, msg: '' };

            /* If the response wasn't a success, show an error alert */
            if( !response )
            {
              errorAlert(response.msg);
              return;
            }

            /* If it was successful, redirect user */
            window.location.href = '';

            return false;
          }
       },
      {
        'text': 'close'
      }
		]
	});
});
  
$('.login').click();

});

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console