Textarea char count fail on page load
English is not my native idiom, so apologies in advance for bad grammar.
I am using a javascript to count the characters of a textarea, the code
work smoothly showing the character limit decreasing when typing, using
this code i called on the textarea a php method to call from a database a
text, and heres is where the problem comes, when testing the page at load
it show the text on the textarea but the character limit stay on 500,
ofcourse it change value if u type on the textarea showing the correct
character limit.
How do i manage to show the correct character limit when the page load?
here is my code:
HTML CODE:
<tr>
<td align="center" colspan="4">
<textarea "rows="10" cols="35" onKeyPress="return charLimit(this)"
onKeyUp="return characterCount(this)"><?php echo $oRep->getDescripcion();
?> </textarea>
</td>
</tr>
<tr>
<td align="center" colspan="4"><p><strong><span
id="charCount">500</span></strong> Caracteres disponibles.</p></td>
</tr>
JS CODE:
<tr>
<td align="center" colspan="4">
<textarea "rows="10" cols="35" onKeyPress="return charLimit(this)"
onKeyUp="return characterCount(this)"><?php echo $oRep->getDescripcion();
?> </textarea>
</td>
</tr>
<tr>
<td align="center" colspan="4"><p><strong><span
id="charCount">500</span></strong> Caracteres disponibles.</p></td>
</tr>
i be tried to add a event on the textrea like 'onchange="return
charLimit(this)"' but with no change.
No comments:
Post a Comment