I’m building a basic module, for a fictional toy store.
Basic Idea is two option select boxes First one chooses the type of kit (Car, Truck or Big Truck) and the second shows the number of parts.
I have got the code working the way it needs to but I have had to break one rule of the task: I had to rename one of the option values to remove a space in it which I am not allowed to do...
This is the option I had to change:
<option value="BigTruck">Big Truck</option>  <--- works if i take the space out
<option value="Big Truck">Big Truck</option> <-- put the space in and it doesnt work as intended
I have attached a jsfiddle with my code, can someone tell me, why/if the space in the option value makes a difference, and if I can adjust my existing js to account for that space that would be great, it's doing my head in...
I have tried "hypothetically" adding a   instead of the space in the option value, and the code still fails to work as it should, so I'm not 100% whether it is the space causing the problem or not...
http://jsfiddle.net/baddog04061980/wtm1dLs2
$(document).ready(function() {
  $('.choice-boxs').hide();
  $('#Car12').show();
  $("#option-kit, #option-parts").on("change", function() {
    $('.choice-boxs').hide();
    $('#' + $('#option-kit').val() + $('#option-parts').val()).show();
  });
});<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div class="option-selectors">
  <div class="selector-wrapper cf">
    <label for="option-kit">
                  Kit
                </label>
    <select id="option-kit">
      <option value="Car" selected="">Car</option>
      <option value="Truck">Truck</option>
      <option value="Big Truck">Big Truck</option>
    </select>
  </div>
  <div class="selector-wrapper cf">
    <label for="option-parts">
                  Parts
                </label>
    <select id="option-parts">
      <option value="12" selected="">
        12
      </option>
      <option value="18">
        18
      </option>
      <option value="24">
        24
      </option>
      <option value="30">
        30
      </option>
      <option value="36">
        36
      </option>
    </select>
  </div>
</div>
<!-- Basic  -->
<div id="Car12" class="choice-boxs">Car and 12 Parts</div>
<div id="Car18" class="choice-boxs">Car and 18 Parts</div>
<div id="Car24" class="choice-boxs">Car and 24 Parts</div>
<div id="Car30" class="choice-boxs">Car and 30 Parts</div>
<div id="Car36" class="choice-boxs">Car and 3 Parts6</div>
<!-- Deluxe -->
<div id="Truck12" class="choice-boxs">Truck and 12 Parts
</div>
<div id="Truck18" class="choice-boxs">Truck and 18 Parts</div>
<div id="Truck24" class="choice-boxs">Truck and 24 Parts</div>
<div id="Truck30" class="choice-boxs">Truck and 30 Parts</div>
<div id="Truck36" class="choice-boxs">Truck and 36 Parts</div>
<!-- Deluxe -->
<div id="BigTruck12" class="choice-boxs">Big Truck and 12 Parts</div>
<div id="BigTruck18" class="choice-boxs">Big Truck and 18 Parts</div>
<div id="BigTruck24" class="choice-boxs">Big Truck and 24 Parts</div>
<div id="BigTruck30" class="choice-boxs">Big Truck and 30 Parts</div>
<div id="BigTruck36" class="choice-boxs">Big Truck and 36 Parts</div> 
     
     
     
     
    