Javascript nested if
<p>Hello everyone I'm trying to do when an option button selected an other option button appears. It works but when the other option button is selected I wanna display text but it does not work here is my code:</p>

<pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
      $(document).ready(function() {

        $(".select-box").change(function() {
          if ($(".select-box option[value='3']").attr('selected')) {
           document.getElementById("demo").innerHTML="&lt;select class='select-box'&gt;&lt;option value='4'&gt;a&lt;/option&gt;&lt;option value='5'&gt;b&lt;/option&gt;&lt;/select&gt;";
          if ($(".select-box option[value='5']").attr('selected')) {
          document.write("Hello")
          }
          }

        }); 

      });
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;select class="select-box"&gt;
      &lt;option&gt;Select an option&lt;/option&gt;
      &lt;option value="1"&gt;no alert&lt;/option&gt;
      &lt;option value="2"&gt;no alert too&lt;/option&gt;
      &lt;option value="3"&gt;alert&lt;/option&gt;
    &lt;/select&gt; 
    &lt;p&gt;&lt;/br&gt;
    &lt;div id="demo"&gt;&lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>
