title: javascript error- Chrome say it's not a function
body: <p>I have a js file and a html. From the html I call the function on click. </p>
  
  <p>My Problem is- The specification_none works, But Chrome prompts the following error:</p>
  
  <blockquote>
    <p>Uncaught TypeError: specification_existing is not a function</p>
  </blockquote>
  
  <p>So what is the Problem? Why doesn't the other function work?</p>
  
  <p>Here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$( document ).ready(function() {
  
          if ($('#radio_specification_none').attr("checked")){
  
              $("#specification_existing_box").hide();    // hide existing_spec
              $("#specification_new_box").hide();         // hide new_spec
  
              $('#specification_existing_box')[0].selectedIndex = 0;          // set existing specifications to default value
  
              $('#specification_existing_box').prop('required', false);        // set existing spec. size the required attribute to false
              $('#specification_new_box').prop('required', false);        // set for new spec. the required attribute to false
          }
          if ($('#radio_specification_existing').attr("checked")){
  
              $("#specification_existing_box").show();            // hide existing_spec
              $("#specification_new_box").hide();                 // hide create new_spec
  
              $('#specification_existing_box').prop('required', true);        // set for new_spec the required attribute to true
              $('#specification_new_box').prop('required', false);            // set for new_spec the required attribute to false
          }
          if ($('#radio_specification_new').attr("checked")){
  
              $("#specification_new_box").show();                // show new_spec
              $("#specification_existing_box").hide();           // hide existing_spec
  
              $('#specification_existing_box')[0].selectedIndex = 0;          // set existing specifications to default value
  
              $('#specification_existing_box').prop('required', false);        // set for new_spec the required attribute to false
              $('#specification_new_box').prop('required', true);             // set for new_spec the required attribute to true
          }
  
      // ---- show and hide sizes ----- //
  
      // children sizes (default)
      $('#radio_child').change(function(){
          if (!$('#radio_child').checked){        // change if other user pick other button; this one is then false
  
              $("#child_sizes").show();           // show child sizes
              $("#konfektion_sizes").hide();      // hide adult sizes
          }
  
          $('#select_konfektion_sizes')[0].selectedIndex = 0;     // set adult size to "Wählen..."
  
          $('#select_child_sizes').prop('required',true);         // set for child size the required attribute to true
          $('#select_konfektion_sizes').prop('required',false);   // set for adult size the required attribute to false
      });
      // adult sizes
      $('#radio_adult').change(function(){        // change if other user pick other button; this one is then false
          if (!$('#radio_adult').checked){
  
              $("#child_sizes").hide();           // hide child sizes
              $("#konfektion_sizes").show();      // show adult sizes
          }
  
          $('#select_child_sizes')[0].selectedIndex = 0;          // set children size to default value
  
          $('#select_child_sizes').prop('required',false);        // set for child size the required attribute to false
          $('#select_konfektion_sizes').prop('required',true);    // set for adult size the required attribute to true
      });
  
  
  
      // triggers
      $('#radio_child').trigger('change');                        // trigger change (child radio) for one time, if document load
  
  });
  
  function specification_none(element){
  
    alert("specification_none");
  
      // change the checked attribute
      $(element).prop('checked', "checked");
      $('#specification_existing_box').prop('checked', "");
      $('#specification_new_box').prop('checked', "");
  
      //hide other specifications
      $("#specification_existing_box").hide();    // hide existing_spec
      $("#specification_new_box").hide();         // hide new_spec
  
      // set existing specifications to default value
      $('#specification_existing_box')[0].selectedIndex = 0;
  
  
      // set the required attribute from THIS input to true
      $('#specification_none_box').prop('required', true);
      // set the required attribute from the other inputs to false
      $('#specification_existing_box').prop('required', false);
      $('#specification_new_box').prop('required', false);
  }
  
  function specification_existing(element){
  
    alert("specification_existing");
  
      // change the checked attribute
      $(element).prop('checked', "checked");
      $('#specification_none_box').prop('checked', "");
      $('#specification_new_box').prop('checked', "");
  
      // show existing box
      $("#specification_existing_box").show();    // hide existing_spec
  
      //hide other specifications
      $("#specification_none_box").hide();    // hide existing_spec
      $("#specification_new_box").hide();         // hide new_spec
  
      // set the required attribute from THIS input to true
      $('#specification_existing_box').prop('required', true);
      // set the required attribute from the other inputs to false
      $('#specification_none_box').prop('required', false);
      $('#specification_new_box').prop('required', false);
  }
  
  function specification_new(element){
  
    alert("specification_new");
  
      // change the checked attribute
      $(element).prop('checked', "checked");
      $('#specification_existing_box').prop('checked', "");
      $('#specification_none_box').prop('checked', "");
  
      //hide other specifications
      $("#specification_existing_box").hide();    // hide existing_spec
      $("#specification_none_box").hide();         // hide new_spec
  
      // set existing specifications to default value
      $('#specification_existing_box')[0].selectedIndex = 0;
  
  
      // set the required attribute from THIS input to true
      $('#specification_new_box').prop('required', true);
      // set the required attribute from the other inputs to false
      $('#specification_existing_box').prop('required', false);
              $('#specification_none_box').prop('required', false);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
  
  &lt;script type="text/javascript"  src="{{ url_for('static', filename='js/my.js') }}" &gt;&lt;/script&gt;
  
   &lt;!--clothes specification--&gt;
      &lt;div class="raidio_box_specifications"&gt;
          &lt;div&gt;
              &lt;table&gt;
                  &lt;tr&gt;
                  &lt;td&gt;&lt;p&gt;Besonderheit:  &lt;/p&gt;&lt;/td&gt;
                  &lt;td  class="custom-control custom-radio custom-control-inline size_art_inner last_radio"&gt;
                      &lt;input type="radio" id="radio_specification_new" name="specification" class="custom-control-input" onclick="specification_new(this)"&gt;
                      &lt;label class="custom-control-label" for="radio_specification_new"&gt;neue erstellen&lt;/label&gt;
                  &lt;/td&gt;
                  &lt;td class="custom-control custom-radio custom-control-inline size_art_inner"&gt;
                      &lt;input type="radio" id="radio_specification_existing" name="specification" class="custom-control-input" onclick="specification_existing(this)" {% if clothing_info[0].clothes_specification_id != 1 %} checked="checked" {% else %}  {% endif %}&gt;
                      &lt;label class="custom-control-label" for="radio_specification_existing" &gt;vorhandene&lt;/label&gt;
                  &lt;/td&gt;
                  &lt;td class="custom-control custom-radio custom-control-inline size_art_inner"&gt;
                      &lt;input type="radio" id="radio_specification_none" name="specification" class="custom-control-input" onclick="specification_none(this)" {% if clothing_info[0].clothes_specification_id == 1 %} checked="checked" {% else %}  {% endif %}&gt;
                      &lt;label class="custom-control-label" for="radio_specification_none"&gt;keine&lt;/label&gt;
                  &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/div&gt;
      &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Can someone help me out here</p>