5. Why not use the var we created in the previous exercise?


I would like to use this:
 $(document).ready(function() { 
    var $p = $('p');

rather than this:
$(document).ready(function() { 
    var $p = $('p');

Why can't I use the var we created before?


can you give me your html code?



@olouthe I think both should work. When you tried it, did it work and you just didn't get passed, or did the first code actually not work?


<!DOCTYPE html>
        <script type='text/javascript' src='script.js'></script>
        <div class="container">
            <div id="one">Div #1</div>
            <div id="two">Div #2</div>


Oops, try again.
Make sure you remove your <p> using the .remove() function.


i'm sorry everyone for the messy posts. i just copy/paste but it doesnt seem to appear in my answers. Anyway thank you for your help. It was mostly a question whether i could use a var rather than the stuff itself. if you say it should work then something else must be wrong in my code. thank you


@olouthe No, I think your code is fine, the problem is with the SCT (Submission Correctness Test; code checker) for this exercise; it's looking at your code and not seeing what it expects, so even though your code works the exercise throws an error :slight_smile: