Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <div class="form-field">
		<label>Password : </label>
		<input type="password" name="password" class="password">
		<span class="password_strength"></span>
	</div>
<span class="post_link">Full Post : http://codetrycatch.com/jquery-password-validations/</span>
              
            
!

CSS

              
                .form-field {
		width: 240px;
		float: left;
		padding: 15px;
		box-sizing: border-box;
		background-color:#f2f2f2;
		border-color:1px solid #ccc
	}
	.password_strength {
		border: 1px solid #ccc;
		padding: 5px;
		float: left;
		clear: left;
		width: 210px;
		box-sizing: border-box;
		border-top: 0;
		text-align: center;
		font-weight: bold;
		display: none;
	}
	.form-field label {
		width: 100%;
		float: left;
		margin-bottom: 5px;
	}
	.form-field input.password {
		width: 210px;
		padding: 5px;
		box-sizing: border-box;
		font-size: 15px;
		float: left;
	}
	.strength_veryweek{
		border-color: #e35b5b;
		background-color: #f1adad;
		display: block;
	}
	.strength_week{
		border-color: #f78b53;
		background-color: #fbc5a9;
		display: block;
	}
	.strength_medium{
		border-color: #ffc733;
		background-color: #ffe399;
		display: block;
	}
	.strength_good{
		border-color: #90EE90;
		background-color: #98FB98;
		display: block;
	}
	.strength_strong{
		border-color: #83c373;
		background-color: #c1e1b9;
		display: block;
	}
.post_link{
  width:100%;float:left;
  margin-top:15px;
}
              
            
!

JS

              
                $(document).ready(function() {
		$(".password").on("keyup", function(){ 
            //set password strength 0
            var password_strength = 0;
            //check if password length is less than 6 characheter
            if ($(this).val().length < 6) { 
            	$(".password_strength")
            	.removeClass("strength_week strength_medium strength_good strength_strong")
            	.text("Very Week")
            	.addClass('strength_veryweek');
            	return false;
            }
            //check if password length is greater than 7 charachter
            if ($(this).val().length > 7) { password_strength += 1;}
            //check if password has upper and lower charachters
            if ($(this).val().match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) { password_strength += 1; }
            //check if password has upper and lower charachters and numbers
            if ($(this).val().match(/([a-zA-Z])/) && $(this).val().match(/([0-9])/)) { password_strength += 1; }
            //check if password has one special charachters
            if ($(this).val().match(/([!,%,&,@,#,$,^,*,?,_,~])/)) { password_strength += 1; }
            //check if password has two special charachters
            if ($(this).val().match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,",%,&,@,#,$,^,*,?,_,~])/)) { password_strength += 1; }
            //check and set strength text according password strength value
            if (password_strength == 1 ) { 
            	$(".password_strength")
            	.removeClass("strength_veryweek strength_medium strength_good strength_strong")
            	.text("Week")
            	.addClass('strength_week'); 
            } 
            else if (password_strength == 2 ) { 
            	$(".password_strength")
            	.removeClass("strength_week strength_veryweek strength_good strength_strong")
            	.text("Medium")
            	.addClass('strength_medium'); 
            } 
            else if (password_strength == 3 ) { 
            	$(".password_strength")
            	.removeClass("strength_week strength_medium strength_veryweek strength_strong")
            	.text("Good")
            	.addClass('strength_good'); 
            }
            else if (password_strength == 4 ) { 
            	$(".password_strength")
            	.removeClass("strength_week strength_medium strength_good strength_veryweek")
            	.text("Strong")
            	.addClass('strength_strong'); 
            }
            
            // you can check password strength in console
            console.log(password_strength);
        });
	});
              
            
!
999px

Console