title: Jquery/JS - hide Div in modal when select options changes
body: <p>I'm trying to hide some textareas on my modal when opening it and when changing the select options, hide or show a div containing all textareas.</p>
  
  <p>I've tried to explain all JS code here : <a href="http://jsfiddle.net/z114zjj6/" rel="nofollow">Demo</a></p>
  
  <p>I'm not saying the code is pretty, I'll be happy to have some advices about it.</p>
  
  <p>I wished I could link more code on this page, but i'm afraid I don't know where the issue is =/ I guess the only interesting thing is the javascript/jquery code ?</p>
  
  <pre><code>$('#create-popup').on('shown.bs.modal', function () {
      if (!$("#act_origin").val()) { //apparently when opening, the val is undefined
          $("#origin-display").hide();
      }
      //function when select is changing. 
      function origin() {
          if ($("#act_origin").val() == 1 ) { //HORSPAF
              $("#origin-display").hide();            
          } else  {
              $("#origin-display").show();
          }
      };
  });
  </code></pre>
  
  <p>I've tried also (when reading other answers)</p>
  
  <pre><code>if ($("#act_origin option:selected").text() === "HORSPAF")
  </code></pre>
  
  <p>and </p>
  
  <pre><code>$("#create-popup").find('#origin-display').hide();
  </code></pre>
  
  <p>I might use them wrong, but it doesn't seem to work either =(</p>
  
  <p>Thanks in advance.</p>