click to add border to div
<p>I have a web page with multiple div. When the user clicks on the body, all div elements will have their border changed to red. However, when the user clicks on a div, only that div will have their border changed to blue.Every other div element will remain with a red border. this is my code so far:</p>

<pre><code>$('body').click(function() {
    var $target = $(event.target);
    if (!target.closest($('div')).length) {
        //I want the border of all div on the page to change to red
        $('div'). css('border', '2px solid red');
    } else if (target.closest($('div')).length) {
        //Here just the div that was clicked on will have its border changed to blue
        $(this).css('border', '2px solid blue');
    }
});
</code></pre>
