title: Uncaught TypeError: Cannot read property 'append' of null in jQuery
body: <p>Starting from this jQuery code:</p>
  
  <pre><code>var country_name_list=document.getElementById("country");            
  $.post(getcountry,function (data) {
      var Rcountry_name_list=JSON.parse(data);
      var arr=[];
      for(var i=0;i&lt;Rcountry_name_list.countries.length;i++){
           var r_id=Rcountry_name_list.countries[i].country_id;
           var r_name= Rcountry_name_list.countries[i].country_name;
           var option_name = document.createElement("option");
           option_name.textContent =r_name;
           option_name.value = r_id;
  
           country_name_list.append(option_name);     
       }
  
  });
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;form method="post" action="" id="rform" novalidate="novalidate"&gt;
      &lt;label class="control-label"&gt;Country &lt;/label&gt;
      &lt;select id="country" name="country" class="form-control" &gt;
          &lt;option value=" " disabled selected hidden&gt;Select Country&lt;/option&gt;
          &lt;option value="0"&gt;&lt;/option&gt;
      &lt;/select&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>On the line <code>country_name_list.append(option_name);</code> I get the following error</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'append' of null in jQuery</p>
  </blockquote>