JQuery addClass to DIV not working? (Beginner question)

Hi i am a beginner with JQUery i am trying to add a Class… to a excisting DIV but for some reason it’s not working neither do i get a error… can somebody help?

THanks :smiley:

<!doctype html>
<title>Test App</title>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>

#banner {
background: #EEE;
width: 500px;
min-height: 250px;
margin: 0 auto;

.red-box {
display: block;
height: 50px;
width: 50px;
background: red;


<section id="banner">


You have no <body></body>.

Also with addClass() you don’t need to have the period in front of red-box. Just do addClass(“red-box”)

1 Like


use above code it should work.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.