Question and answer is powered by AnsPress.io
I am work with jQuery in my HTML page and I want to check if texts exist in HTML div using jquery. How can I do it?
If you want to check texts exist in the HTML div, you can follow this code:
HTML DIV:
<div id=”content”>
<p>this time for test</p>
</div>
Script:
<script>
if($(‘#content’).text().length > 0) {
alert(“hello”);
}
</script>