RadLikeWhoa / Countable

Add live paragraph-, word- and character-counting to an HTML element.
https://sacha.me/Countable
MIT License
1.64k stars 134 forks source link

use class instead of id #32

Closed quasiperfect closed 9 years ago

quasiperfect commented 9 years ago

hi

thanks for this great script

if there a way to use a class name to assign countable for present and future elements (added by ajax jquery) ?

thanks in advance for your help

RadLikeWhoa commented 9 years ago

You can use something like document.querySelectorAll('.classname') to bind Countable to multiple elements with the same class, but this only happens once. What you're trying to achieve leans towards event delegation, but this is out of scope for this library.

You can, however, remove the functionality from all affected elements using Countable.die and then re-attach the functionality.