my problem is very simple: I want to know how many characters are inside a ‘p’ tag and if the number is over 100 fire an event on hover.
I tried to retrieve the char number like this:
var charLength = $('.myPar').val().length;
<p class="myPar">this is the content of the paragraph</p>
it returns always zero as value and it seems to work only for textarea or input tags.
Any idea?
Thanks in advance!
Mauro
$('.myPar:first').html().lengthor
$('.myPar:first').text().lengthdepending on your use case