Skip to content

Commit

Permalink
Merge pull request darrentaytay#7 from ChrisMagellan/master
Browse files Browse the repository at this point in the history
Parse HTML5 attributes for max length
  • Loading branch information
darrentaytay committed Feb 16, 2015
2 parents 2d7945a + 0d99a18 commit 216a69e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jquery.charactercounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
var options = $.extend(defaults, opts);

return this.each(function() {
var html5len = $(this).attr('maxlength');
if (typeof html5len !== typeof undefined && html5len !== false) {
$.extend(defaults, {
limit: parseInt($(this).attr('maxlength'))
});
}
if (!options.counterSelector) {
$(this).after(generateCounter());
}
Expand Down

0 comments on commit 216a69e

Please sign in to comment.