title: My selectbox becomes disabled when accessed through session
body: <p>I am using Laravel framework and some jquery code. </p>
  
  <p>The problem is that, when i submit the data, it is successfully saved in session. when i get back to previous page, My select box shows the selected value  but select-box is disabled. i am totally confused. what shall i do here?</p>
  
  <p>Here is my HTML code:-</p>
  
  <pre><code>&lt;div class="one-row"&gt;
    &lt;?php foreach ($services as $key =&gt; $allservices){ 
      if($key &lt;= 3){  
        if(!empty($data['services'])){
          if(in_array($allservices['id'],$data['services'])) {
            $checked = "checked";
          } else {
            $checked = "";
          }
        } else {
          $checked = "";
        } 
      ?&gt;
      &lt;div class="div_img_part-2"&gt; 
        &lt;span class="img_part_class-2"&gt;
          &lt;img src="{{ 
              asset('images/ServiceImages/'. $allservices['image'])}}"&gt;&lt;/span&gt;
          &lt;span class="text_part_class-2"&gt;
          &lt;span class="check-box"&gt;
          &lt;input type="checkbox" name="services[]" value="
            &lt;?php echo $allservices['id']; ?&gt;" &lt;?= $checked; ?&gt;&gt;&lt;?php echo $allservices['name']; ?&gt;&lt;/span&gt;
        &lt;/span&gt;
        &lt;select name="services[&lt;?php echo $allservices['name'];?&gt;]"class="selectpicker"&gt;
          &lt;option value=""&gt;Select Your Sevice&lt;/option&gt;
          &lt;option value="Salon" &lt;?php if(!empty($data['services'][$allservices['name']])){ if($data['services'][$allservices['name']] == "Salon") {?&gt; selected
          &lt;?php } } ?&gt; &gt;Salon&lt;/option&gt;
          &lt;option value="Mobile beautician" &lt;?php if(!empty($data['services'][$allservices['name']])){ if($data['services'][$allservices['name']] == "Mobile beautician") {?&gt; selected
          &lt;?php } }?&gt; &gt;Mobile beautician&lt;/option&gt;
          &lt;option value="Both" &lt;?php if(!empty($data['services'][$allservices['name']])){ if($data['services'][$allservices['name']] == "Both") {?&gt; selected
          &lt;?php } } ?&gt;&gt;Both&lt;/option&gt;
        &lt;/select&gt;
      &lt;/div&gt;
    &lt;?php } } ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And my Jquery Code looks:-</p>
  
  <pre><code>&lt;script&gt;
    $(document).ready(function () {
      $(".div_img_part-2 .selectpicker").attr("disabled",true);
      $('.selectpicker').selectpicker('refresh');
      $(".check-box input[type='checkbox']").on("change", function () {
        if ($(this).prop("checked") == true) {
          $(this).parents(".div_img_part-2").find(".selectpicker").removeAttr("disabled");
          $('.selectpicker').selectpicker('refresh');
        }else{
        $(this).parents(".div_img_part-2").find(".selectpicker").attr("disabled",true);
        $('.selectpicker').selectpicker('refresh');
      }
    });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>Firstly Select
  <a href="https://i.stack.imgur.com/4d4KO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4d4KO.png" alt="enter image description here"></a></p>
  
  <p>After Select(Edit)
  <a href="https://i.stack.imgur.com/rFlyE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rFlyE.png" alt="enter image description here"></a></p>
  
  <p>Note:- when user selects the checkbox, the selectbox will be active at first time of registration. All my data are saved in session in Laravel please help me :(</p>