title: Toggle onClick jquery
body: <p>I am new to web-designing. I have this sample code which toggles a div when we click anywhere on the window.</p>
  
  <pre><code>&lt;!doctype html&gt;
     &lt;html lang="en"&gt;
       &lt;head&gt;
         &lt;meta charset="utf-8"&gt;
              &lt;title&gt;slide demo&lt;/title&gt;
                 &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"&gt;
                     &lt;style&gt;
                       #toggle {
                       width: 100px;
                       height: 100px;
                       background: #ccc;
                       }
                     &lt;/style&gt;
                     &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
                     &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;                       &lt;/script&gt;
         &lt;/head&gt;
         &lt;body&gt;
  
         &lt;p&gt;Click anywhere to toggle the box.&lt;/p&gt;
         &lt;div id="toggle"&gt;&lt;/div&gt;
  
         &lt;script&gt;
            $( document ).click(function() {
            $( "#toggle" ).toggle( "slide" );
            });
         &lt;/script&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>How can I add an image and change the image for show and hide? I have an '>' icon. When I click on it, div should appear and '>' should change to '&lt;'</p>