Javascript examples for Statement:if
If condition with ===
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w ww. j a va2 s .com var x = document.getElementById("test"); var text = 'There are No friends posts yet my love!!'; console.log(x.innerText == '') if(x.innerText === ''){ x.innerText = text; } } </script> </head> <body> <div id="test"> </div> </body> </html>