show certain div by choosing option in two select's (html form tag)

show certain div by choosing option in two select's (html form tag)

Create a simple html page with a form.
Form elements:
- dropdown 1 options: red, green, blue
- dropdown 2 options: rectangle, circle
- button “Add”

1. When user clicks “add”, the appropriate figure should appear on the page.
2. User should be able to remove any figure
3. Add clear button, which clears all figures on the page

should use jQuery.

how to do it ?

I'd try something like this: 
  1. HTML
  2.  <div id="main">
  3.     <form action="#">
  4.       <ul>
  5.         <li>
  6.           <select id="color" name="color">
  7.             <option value="red">red</option>
  8.             <option value="green">green</option>
  9.             <option value="blue">blue</option>
  10.           </select>
  11.         </li>
  12.         <li>
  13.           <select id="type" name="type">
  14.             <option value="rectangle">rectangle</option>
  15.             <option value="circle">circle</option>
  16.           </select>
  17.           <br>
  18.         </li>
  19.         <li>
  20.           <input type="submit" onclick="show_fig();">
  21.         </li>
  22.       </ul>
  23.     </form>
  24.     <div id="rectangle_div_id"></div>
  25.     <div id="circle_div_id"></div>
  26.   </div>
  27.   <script type="text/javascript" src='js/jQuery.js'></script>
  28.   <script type="text/javascript" src='js/showFig.js'></script>
CSS:
  1. body {
  2.   font: 16px Verdana, Arial, Helvetica;
  3.   color: #333;
  4. }
  5. #main {
  6.   margin: 0 auto;
  7.   position: relative;
  8.   width: 250px;
  9.   background-color: lightgreen;
  10.   height: 300px;
  11.   padding: 10px 45px;
  12. }
  13. form {
  14.   width: 240px;
  15.   margin: 0;
  16.   padding: 0;
  17. }

  18. form ul {
  19.   margin: 5px auto;
  20.   padding: 0;
  21.   width: 100px;
  22. }
  23. form li {
  24.   list-style: none;
  25.   margin: 10px 0;
  26.   padding: 0;
  27.   width: 100px;

  28. }

  29. form select {
  30.   border-radius: 5px;
  31.   padding: 0 ;
  32.   width: 100px;
  33. }

  34. form input {
  35.   border-radius: 5px;
  36.   width: 100px;
  37.   height: 26px;
  38.   font-weight: bold;
  39. }

  40. #rectangle_div_id {
  41.   width: 50px; 
  42.   height: 50px;
  43.   background-color: black;
  44. }

  45. #green_rectangle {
  46.   width: 50px; 
  47.   height: 50px;
  48. }

  49. #blue_rectangle {
  50.   width: 50px; 
  51.   height: 50px;
  52. }

  53. #red_circle {
  54.   width: 50px; 
  55.   height: 50px; 
  56.   border-radius: 50%
  57. }

  58. #green_circle {
  59.   width: 50px; 
  60.   height: 50px; 
  61.   border-radius: 50%
  62. }

  63. #blue_circle {
  64.   width: 50px; 
  65.   height: 50px; 
  66.   border-radius: 50%
  67. }

  68. #circle_div_id, #rectangle_div_id, #blue_rectangle, #red_circle, #green_circle, #blue_circle {
  69.   display: none;
  70. }
and js:

  1. $(document).ready(function() {
  2.   if $('select:option[0]').selected==true {
  3.     $('#rectangle_div_id').css('display','block');
  4.   }
  5. });
but it doesn't works.
I can't write condition like "if select.option.first_value.selected==true, then rectangle_div.show 
else if select.option.second_value.selected==true then circle_div.show"