Adding and removing classes proper code still error


#1


https://www.codecademy.com/en/courses/web-beginner-en-v6phg/1/1?curriculum_id=50a3fad8c7a770b5fd0007a1#


My code is exactly what has been suggested and has worked for others stuck on this same exercise. I, though, am still getting this message:

"Oops, try again. Please follow the instructions on the Full Preview page to test your code."

It was suggested in a similar post that the issue could be with the HTML or CSS, so I will include that in the code section along with my JQuery.


$(document).ready(function(){
    $('#text').click(function(){
        $(this).addClass('highlighted');
    });
});

___________________________________________________________
#title {
    background-color: #C02942;
    border-radius: 5px;
    text-align: center;
    font-family: Verdana, Arial, Sans-Serif;
    color: #FFFFFF;
    width: 200px;
    height: 25px;
}

#text {
    background-color: #0B486B;
    border-radius: 5px;
    text-align: center;
    font-family: Vivaldi, Cursive;
    color: #FFFFFF;
    width: 200px;
    height: 25px;
}

.highlighted {
    -webkit-box-shadow: 0 0 8px #FFD700;
    -moz-box-shadow: 0 0 8px #FFD700;
    box-shadow: 0 0 8px #FFD700;
    cursor:pointer;
}

__________________________________________________________

<!DOCTYPE html>
<html>
    <head>
        <title>Highlights</title>
        <link rel='stylesheet' type='text/css' href='stylesheet.css'/>
        <script type='text/javascript' src='script.js'></script>
   </head>
   <body>
        <div id="title" class="highlighted">I'm highlighted!</div>
        <div id="text">Highlight me, too!</div>
   </body>
</html>

EDIT: Resolved.


#2

Hi, your code is working fine.
Paste this:
$(document).ready(function(){
$('#text').click(function(){
$(this).addClass('highlighted');
});
});

in script.js part


#3

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