Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<meta charset=utf-8 />
<title>How to check element is empty Demo</title>
</head>
<body>
   <div id="dvText">
     <a href="trifecta" id="thistest">Test</a>
   </div>
</body>
</html>
 
var str = $('#dvText').html();
//alert ("1"+str+"2");
     str = $.trim(str);
     if (str) {
        alert('Proceed as element is not empty.');
      } else   {
        alert('Element is empty');
      }
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers