is correct how i used .prepend() ?
Hello,
I made a page using jQuery That adds elements at the click of another element using .prepend ();
It works fine.
in html we have this element:
- <label>Motivo del Reso / Guasto * <span id="charNum1">(200 Caratteri disponibili)</span></label>
<textarea class="difetto" id="difetto1" name="difetto1" cols="50" rows="2" maxlength="200" required="required" aria-required="true" placeholder=""></textarea>
and at the end of body i use jquery for count number of chars in textarea:
-
jQuery('#difetto1').keyup(function () {
var max = 200;
var len = jQuery(this).val().length;
if (len >= max) {
jQuery('#charNum1').text(' (Limite massimo caratteri raggiunto)');
} else {
var char = max - len;
jQuery('#charNum1').text('(' + char + ' Caratteri disponibili)');
}
});
This works only for element created by html.
But it does not works for textarea created by .prepend()
This is the page if anyone want to inspect che sourcecode: Click here
What may be the problem??
Thanks!