Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1698 from locaweb/fix/char_counter
Browse files Browse the repository at this point in the history
Correção do bug do char counter
  • Loading branch information
itumoraes authored Jul 18, 2016
2 parents c85861b + 50510dc commit 1e0a7f1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/assets/javascripts/locastyle/_char-counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ locastyle.charCounter = (function() {

function countText() {
$('[data-ls-module="charCounter"]').each(function(index, field) {
$('.ls-number-counter-' + index).parents('.ls-help-inline').remove();

var limit = $(field).attr('maxlength');
var html = '<p class="ls-help-inline"><small><strong ' +
'class="ls-char-count ls-number-counter-' + index + '">' + limit +
'</strong> caracteres restantes</small></p>';
var prefixGroup = $(field).closest('.ls-prefix-group');

$(field).removeAttr('maxlength').data().maxlength = limit;
$(field).data().maxlength = limit;

if (prefixGroup.length) {
prefixGroup.after(html);
Expand Down

0 comments on commit 1e0a7f1

Please sign in to comment.