BigbyBoss72
BigbyBoss72

Reputation: 3

How do i display my code with jQuery?

I wanted to try something simple today with jQuery, but it doesn't seem to display anything on the page, whatever i try.

<!DOCTYPE html>
  <html>
   <head>
    <style type="text/css">
     div{
      height:100px;
      width:100px;
      background-color:#FF0000;
      border-radius:5px;
     }
    </style>
    <script>
     $(document).ready(function(){
      $('div').fadeOut(1000);
     });
    </script>
   </head>
  <body>
   <div>
   </div>   
  </body>
 </html>

Fixed it. I just forgot to put the jQuery script in it.

Upvotes: 0

Views: 39

Answers (2)

Theox
Theox

Reputation: 1363

Your code looks correct, but its result isn't visible.

Your jQuery code makes your div slowly disappear. But the said div is empty, so it is invisible.

Put something into your div and you'll see some results !

Also, don't forget to include the jQuery source.

Upvotes: 0

Dan
Dan

Reputation: 5972

You don't seem to be including jquery. Try adding this:

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>

Upvotes: 2

Related Questions