Skip to content

Commit 05c94f3

Browse files
committed
fix #4
1 parent 53c3f6c commit 05c94f3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

dist/jquery-ensure-max-length.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jquery-ensure-max-length.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@
1717
var _self = this;
1818

1919
this.showCount();
20-
20+
this.addMaxlengthAttribute();
2121
this.element.on( 'keyup blur', function () {
2222
_self.checkLength.call( _self, this );
2323
});
2424
};
2525

26+
Plugin.prototype.addMaxlengthAttribute = function () {
27+
this.element.attr('maxlength', this.options.limit);
28+
};
29+
2630
Plugin.prototype.showCount = function () {
2731
if ( this.options.placement ) this.$counter.appendTo( this.options.placement );
2832
else this.$counter.insertAfter( this.element );

0 commit comments

Comments
 (0)