Logo
Stockholm-icons / Layout / Layout-4-blocks Created with Sketch.
Stockholm-icons / Communication / Chat6 Created with Sketch.
Logo
Stockholm-icons / Layout / Layout-polygon Created with Figma. Stockholm-icons / Tools / Compass Created with Sketch.
This plugin integrates by default with Twitter bootstrap using badges to display the maximum length of the field where the user is inserting text. Uses the HTML5 attribute "maxlength" to work.
For more info please visit the plugin's Demo Page or Github Repo.

Bootstrap Maxlength Examples


							<div class="card card-custom">
								<div class="card-header">
									<h3 class="card-title">
										Bootstrap Maxlength Examples
									</h3>
								</div>
								<!--begin::Form-->
								<form class="form">
									<div class="card-body">
										<div class="form-group row">
											<label class="col-form-label text-right col-lg-3 col-sm-12">Default Usage</label>
											<div class="col-lg-4 col-md-9 col-sm-12">
												<input type='text' class="form-control" id="kt_maxlength_1" maxlength="3"  placeholder="" type="text"/>
												<span class="form-text text-muted">The badge will show up by default when the remaining chars are 3 or less</span>
											</div>
										</div>
										<div class="form-group row">
											<label class="col-form-label text-right col-lg-3 col-sm-12">Threshold Demo</label>
											<div class="col-lg-4 col-md-9 col-sm-12">
												<input type='text' class="form-control" id="kt_maxlength_2" maxlength="7"  placeholder="" type="text"/>
												<span class="form-text text-muted">Set threshold value to show there are 5 chars or less</span>
											</div>
										</div>
										<div class="form-group row">
											<label class="col-form-label text-right col-lg-3 col-sm-12">Always Show</label>
											<div class="col-lg-4 col-md-9 col-sm-12">
												<input type='text' class="form-control" id="kt_maxlength_3" maxlength="6"  placeholder="" type="text"/>
												<span class="form-text text-muted">Show the counter on input focus</span>
											</div>
										</div>
										<div class="form-group row">
											<label class="col-form-label text-right col-lg-3 col-sm-12">Custom Text</label>
											<div class="col-lg-4 col-md-9 col-sm-12">
												<input type='text' class="form-control" id="kt_maxlength_4" maxlength="8"  placeholder="" type="text"/>
												<span class="form-text text-muted">Display custom text on input focus</span>
											</div>
										</div>
										<div class="form-group row">
											<label class="col-form-label text-right col-lg-3 col-sm-12">Textarea Example</label>
											<div class="col-lg-4 col-md-9 col-sm-12">
												<textarea class="form-control" id="kt_maxlength_5" maxlength="8"  placeholder="" rows="6"></textarea>
												<span class="form-text text-muted">Bootstrap maxlength supports textarea as well as inputs</span>
											</div>
										</div>
										<div class="form-group row">
											<label class="col-form-label text-right col-lg-3 col-sm-12">Positions</label>
											<div class="col-lg-4 col-md-9 col-sm-12">
												<input type='text' class="form-control" id="kt_maxlength_6_1" maxlength="8"  placeholder="Top left" type="text"/>
												<div class="mt-3"></div>
												<input type='text' class="form-control" id="kt_maxlength_6_2" maxlength="8"  placeholder="Top right" type="text"/>
												<div class="mt-3"></div>
												<input type='text' class="form-control" id="kt_maxlength_6_3" maxlength="8"  placeholder="Bottom left" type="text"/>
												<div class="mt-3"></div>
												<input type='text' class="form-control" id="kt_maxlength_6_4" maxlength="8"  placeholder="Bottom right" type="text"/>
												<span class="form-text text-muted">The field counter can be positioned at the top, bottom, left or right.</span>
											</div>
										</div>
										<div class="form-group row">
											<label class="col-form-label text-right col-lg-3 col-sm-12">Modal Demos</label>
											<div class="col-lg-4 col-md-9 col-sm-12">
												<a href="" class="btn btn-light-primary font-weight-bold" data-toggle="modal" data-target="#kt_maxlength_modal">Launch maxlength inputs on modal</a>
											</div>
										</div>
									</div>
									<div class="card-footer">
										<div class="row">
											<div class="col-lg-9 ml-lg-auto">
												<button type="reset" class="btn btn-primary mr-2">Submit</button>
												<button type="reset" class="btn btn-secondary">Cancel</button>
											</div>
										</div>
									</div>
								</form>
								<!--end::Form-->
							</div>
						

						// Class definition

						var KTBootstrapMaxlength = function () {

							// Private functions
							var demos = function () {
								// minimum setup
								$('#kt_maxlength_1').maxlength({
									warningClass: "label label-warning label-rounded label-inline",
									limitReachedClass: "label label-success label-rounded label-inline"
								});

								// threshold value
								$('#kt_maxlength_2').maxlength({
									threshold: 5,
									warningClass: "label label-warning label-rounded label-inline",
									limitReachedClass: "label label-success label-rounded label-inline"
								});

								// always show
								$('#kt_maxlength_3').maxlength({
									alwaysShow: true,
									threshold: 5,
									warningClass: "label label-danger label-rounded label-inline",
									limitReachedClass: "label label-primary label-rounded label-inline"
								});

								// custom text
								$('#kt_maxlength_4').maxlength({
									threshold: 3,
									warningClass: "label label-danger label-rounded label-inline",
									limitReachedClass: "label label-success label-rounded label-inline",
									separator: ' of ',
									preText: 'You have ',
									postText: ' chars remaining.',
									validate: true
								});

								// textarea example
								$('#kt_maxlength_5').maxlength({
									threshold: 5,
									warningClass: "label label-danger label-rounded label-inline",
									limitReachedClass: "label label-primary label-rounded label-inline"
								});

								// position examples
								$('#kt_maxlength_6_1').maxlength({
									alwaysShow: true,
									threshold: 5,
									placement: 'top-left',
									warningClass: "label label-danger label-rounded label-inline",
									limitReachedClass: "label label-primary label-rounded label-inline"
								});

								$('#kt_maxlength_6_2').maxlength({
									alwaysShow: true,
									threshold: 5,
									placement: 'top-right',
									warningClass: "label label-success label-rounded label-inline",
									limitReachedClass: "label label-primary label-rounded label-inline"
								});

								$('#kt_maxlength_6_3').maxlength({
									alwaysShow: true,
									threshold: 5,
									placement: 'bottom-left',
									warningClass: "label label-warning label-rounded label-inline",
									limitReachedClass: "label label-primary label-rounded label-inline"
								});

								$('#kt_maxlength_6_4').maxlength({
									alwaysShow: true,
									threshold: 5,
									placement: 'bottom-right',
									warningClass: "label label-danger label-rounded label-inline",
									limitReachedClass: "label label-primary label-rounded label-inline"
								});

								// Modal Examples

								// minimum setup
								$('#kt_maxlength_1_modal').maxlength({
									warningClass: "label label-warning label-rounded label-inline",
									limitReachedClass: "label label-success label-rounded label-inline",
									appendToParent: true
								});

								// threshold value
								$('#kt_maxlength_2_modal').maxlength({
									threshold: 5,
									warningClass: "label label-danger label-rounded label-inline",
									limitReachedClass: "label label-success label-rounded label-inline",
									appendToParent: true
								});

								// always show
								// textarea example
								$('#kt_maxlength_5_modal').maxlength({
									threshold: 5,
									warningClass: "label label-danger label-rounded label-inline",
									limitReachedClass: "label label-primary label-rounded label-inline",
									appendToParent: true
								});

								// custom text
								$('#kt_maxlength_4_modal').maxlength({
									threshold: 3,
									warningClass: "label label-danger label-rounded label-inline",
									limitReachedClass: "label label-success label-rounded label-inline",
									appendToParent: true,
									separator: ' of ',
									preText: 'You have ',
									postText: ' chars remaining.',
									validate: true
								});
							}

							return {
								// public functions
								init: function() {
									demos();
								}
							};
						}();

						jQuery(document).ready(function() {
							KTBootstrapMaxlength.init();
						});

						
The badge will show up by default when the remaining chars are 3 or less
Set threshold value to show there are 5 chars or less
Show the counter on input focus
Display custom text on input focus
Bootstrap maxlength supports textarea as well as inputs
The field counter can be positioned at the top, bottom, left or right.

User Profile 15 messages

Recent Notifications
Stockholm-icons / Layout / Layout-polygon Created with Figma. Stockholm-icons / Files / File-done Created with Sketch.

Important Notice

Lorem Ipsum is simply dummy text of the printing and industry.

Stockholm-icons / Layout / Layout-polygon Created with Figma. Stockholm-icons / Design / Pen&ruller Created with Sketch.

System Update

There are many variations of passages of Lorem Ipsum available.

Stockholm-icons / Layout / Layout-polygon Created with Figma. Stockholm-icons / General / Thunder-move Created with Sketch.

Server Maintenance

Contrary to popular belief, Lorem Ipsum is not simply random text.

Stockholm-icons / Layout / Layout-polygon Created with Figma. Stockholm-icons / Home / Alarm-clock Created with Sketch.

DB Migration

If you are going to use a passage of Lorem Ipsum, you need.

System Messages
Stockholm-icons / Communication / Group-chat Created with Sketch.
09:30 AM

To start a blog, think of a topic about and first brainstorm ways to write details

Stockholm-icons / General / Attachment2 Created with Sketch.
2:45 PM

To start a blog, think of a topic about and first brainstorm ways to write details

Stockholm-icons / Home / Library Created with Sketch.
3:12 PM

To start a blog, think of a topic about and first brainstorm ways to write details

Stockholm-icons / Communication / Add-user Created with Sketch.
7:05 PM

To start a blog, think of a topic about and first brainstorm ways to write details

Privacy Settings:

After you log in, you will be asked for additional information to confirm your identity.

Security Settings:

After you log in, you will be asked for additional information to confirm your identity. For extra security, this requires you to confirm your email. Learn more.

Stockholm-icons / Navigation / Up-2 Created with Sketch.

Select A Demo

Demo 1
Demo 2
Demo 3
Demo 4
Demo 5
Demo 6
Demo 7
Demo 8
Demo 9