jquery-character-counter icon indicating copy to clipboard operation
jquery-character-counter copied to clipboard

Support for per-field limits

Open JamesSkemp opened this issue 10 years ago • 1 comments

If adding a counter to multiple fields, with each having a different maxlength, the limit on the last counter on the page will be used for all other counters. This stores the limit on the respective counter instead.

JamesSkemp avatar Oct 21 '15 14:10 JamesSkemp

This is my first attempt at a pull request, so please be gentle :)

This is related to https://github.com/dtisgodsson/jquery-character-counter/issues/10.

While it seemed to work, once I started typing into a field I found that the maximum length had been set to whatever was set on the last field on the page (options.limit is updated for each field, with the last having the final say).

This stores the length on the counter element itself instead, which is then checked.

JamesSkemp avatar Oct 21 '15 14:10 JamesSkemp