Skip to content

Commit

Permalink
Merge pull request #5 from vsilva472/develop
Browse files Browse the repository at this point in the history
Fix #4
  • Loading branch information
vsilva472 authored Apr 12, 2019
2 parents 092341b + 87e20ee commit cf6335d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ You can also change the separator `/` to wherever symbol or word you want. In th

### Changelog

1.0.1 - 2019-04-12
* Fix #4 Maxlength

1.0.0 - 2018-12-02
* Initial Commit

Expand Down
2 changes: 1 addition & 1 deletion dist/jquery-ensure-max-length.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ <h2>Specifying where to append the counter element</h2>
<footer>
<div class="container">
<div class="row">
<div class="col-xs-12 text-muted text-right">MIT - Version 1.0.0</div>
<div class="col-xs-12 text-muted text-right">MIT - Version 1.0.1</div>
</div>
</div>
</footer>
Expand Down
6 changes: 5 additions & 1 deletion src/jquery-ensure-max-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@
var _self = this;

this.showCount();

this.addMaxlengthAttribute();
this.element.on( 'keyup blur', function () {
_self.checkLength.call( _self, this );
});
};

Plugin.prototype.addMaxlengthAttribute = function () {
this.element.attr('maxlength', this.options.limit);
};

Plugin.prototype.showCount = function () {
if ( this.options.placement ) this.$counter.appendTo( this.options.placement );
else this.$counter.insertAfter( this.element );
Expand Down

0 comments on commit cf6335d

Please sign in to comment.