Jquery if() statement

Out of context: Reply #10

  • Started
  • Last post
  • 16 Responses
  • noob123450

    bigtrickagain, tried this and it does return false now. However, now it returns everything false-

    <script>
    if($(".visible").length > 0) {
    alert("true");
    } else{
    alert("false");
    }
    </script>
    </head>

    <body>
    <div id="firstDiv" class="visible">
    <img src="images/01-helv.jpg" />
    </div>
    <div>
    <img src="images/02-target.jpg" />
    </div>
    <div>
    <img src="images/03-wall.jpg" />
    </div>
    <div>
    <img src="images/04-audi.jpg" />
    </div>
    <div>
    <img src="images/05-bug.jpg" />
    </div>
    </body>

View thread