Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
  <div class="row">
    <div class="col-lg-12">
      <div class="card">
        <div class="card-header">
          <h2 class="text-center">Input based on select</h2>
        </div>
        <div class="card-body">
          <p class="lead text-center">Example of a select form with an input appearing based on the
            selection.</p>
          <p class="text-center">Change the select input below to see the changes</p>
          <form id="submit-form" method="post" action="" role="form">
            <div class="row">
              <div class="col-md-12">
                <div class="form-group">
                  <label for="player_type">Find players by:</label>
                  <select id="player_type" name="player_type" class="form-control">
                    <option value="team">Team</option>
                    <option value="experience">Experience</option>
                    <option value="age">Age</option>
                    <option value="surname">Surname beginning with:</option>
                    <option value="all" selected>All</option>
                  </select>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-md-12">
                <div class="form-group">
                  <div id="experiance">
                    <select id="exp" name="exp" class="form-control">
                      <option value="1">1 Year</option>
                      <option value="2">2-3 Years</option>
                      <option value="3">3-5 Years</option>
                      <option value="4">6+ Years</option>
                    </select>
                  </div>
                  <div id="teams">
                    <select id="team" name="team" class="form-control">
                      <option value="1">Rangers</option>
                      <option value="2">Blazers</option>
                      <option value="3">Mystics</option>
                      <option value="4">United</option>
                      <option value="5">Power</option>
                      <option value="6">Kings</option>
                    </select>
                  </div>
                  <div id="ages">
                    <select id="age" name="age" class="form-control">
                      <option value="1">18-20</option>
                      <option value="2">20-25</option>
                      <option value="3">25-28</option>
                      <option value="4">28+</option>
                    </select>
                  </div>
                  <div id="surname">
                    <input type='text' class='form-control' id='surname' maxlength='1' minlength='1' value='H'>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 text-center">
                <input type="submit" class="btn btn-success btn-send" value="Search">
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                body {
  background-color: #c3e775;
}

.card-body {
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  padding: 1.25rem 1.25rem 0.5rem 1.25rem;
}

.card {
  background-color: #9af5a8;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12), 0 3px 6px rgba(0, 0, 0, 0.2);
}

.card:hover {
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.24);
}

.card-header {
  background-color: #a3f4dd;
  border-bottom: 1px solid rgb(91, 186, 255);
}

.btn-success {
  color: #464646;
  background-color: #b9deff;
  border-color: #566bdc;
  padding: 0.6rem 8rem;
  transition: ease-in-out 0.5s;
}

.btn-success:hover {
  color: #fff;
  background-color: #96bcdf;
  border-color: #507ba0;
}

.form-control {
  padding: 0.375rem 0.75rem;
  color: #fff;
  background-color: #89bbca;
  border: 1px solid #95aae9;
  border-radius: 0.45rem;
}

.form-control:focus {
  color: #495057;
  background-color: #c9d6f6;
  border-color: #8e93e5;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 4, 255, 0.15);
}

::-webkit-input-placeholder {
  /* WebKit, Blink, Edge */
  color: #d7eeff !important;
}

:-moz-placeholder {
  color: #d7eeff !important;
  opacity: 1;
}

::-moz-placeholder {
  color: #d7eeff !important;
  opacity: 1;
}

::placeholder {
  color: #d7eeff;
}

              
            
!

JS

              
                $(document).ready(function () {
  toggleFields();
  $("#player_type").change(function () {
    toggleFields();
  });
});

function toggleFields() {
  if ($("#player_type").val() === "experience") {
    $("#experiance").show();
  } else {
    $("#experiance").hide();
  }
  if ($("#player_type").val() === "team") {
    $("#teams").show();
  } else {
    $("#teams").hide();
  }
  if ($("#player_type").val() === "age") {
    $("#ages").show();
  } else {
    $("#ages").hide();
  }
    if ($("#player_type").val() === "surname") {
    $("#surname").show();
  } else {
    $("#surname").hide();
  }
}

              
            
!
999px

Console