Reputation: 3626
I am using charcount.js to count the number of characters entered in the textarea..
<textarea class="counter" rows="3"></textarea>
in jquery i called it as
$('.counter').charCount();
it works for me...when i created the textarea in the javascript dynamically it does not works
var txtar=document.createElement("textarea");
txtar.setAttribute("maxlength","140");
txtar.setAttribute("class","counter");
ad.appendChild(txtar);
the textarea correctly added into the document but the charcount function not works .....
how can i resolve this
thanks in advance
Upvotes: 0
Views: 94
Reputation: 129812
Are you calling charCount()
after the element has been appended to the DOM? You should be.
Upvotes: 1