How to check if element have any text
- by user3611403
How can I check, if element does have any text? I have found some code, but it does not work. I need to do something like this: If element has text, write this, if not, write something else.
if (!$('.flexslider .item:first p').text().trim().length) {
var text = $(this).text();
$('.text-anim-sphone').html(text);
}
else {
$('.text-anim-sphone').html('welcome');
}