Skip to content

Commit

Permalink
Merge pull request darrentaytay#9 from wardtwits/master
Browse files Browse the repository at this point in the history
jQuery .bind changed to .on
  • Loading branch information
darrentaytay committed Mar 23, 2015
2 parents 216a69e + a64eded commit d725bc5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions jquery.charactercounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@

function customFields(params)
{
var html='';
var i, html='';

for (var i in params)
for (i in params)
{
html += ' ' + i + '="' + params[i] + '"';
}
Expand Down Expand Up @@ -87,7 +87,7 @@
function checkCount(element)
{
var characterCount = $(element).val().length;
var counter = options.counterSelector ? $(options.counterSelector) : $(element).next("." + options.counterCssClass);
var counter = options.counterSelector ? $(options.counterSelector) : $(element).siblings("." + options.counterCssClass);
var remaining = options.limit - characterCount;
var condition = remaining < 0;

Expand Down Expand Up @@ -118,10 +118,10 @@
function bindEvents(element)
{
$(element)
.bind("keyup", function () {
.on("keyup", function () {
checkCount(element);
})
.bind("paste", function () {
.on("paste", function () {
var self = this;
setTimeout(function () { checkCount(self); }, 0);
});
Expand Down

0 comments on commit d725bc5

Please sign in to comment.