title: MVC4 Show a description field when selecting 'other' from a dropdownlist
body: <p>I have a simple problem that just eludes me. I've seen lots of examples but just can't put my finger on the correct code. The problem: I need to show a text input field only if 'Other' is selected from a dropdownlist.</p>
  
  <p>My JavaScript:</p>
  
  <pre><code>@{
      ViewBag.Title = "Create Client";
      var showGenderDescription = false;
      var showSettingDescription = false;
  }
  
  &lt;script src="~/Scripts/jquery-2.0.3.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      $(function () {
          $('#GenderId').change(function () {
              if ($("#GenderId").val() == 3) {
              showGenderDescription = true;
  
              }
          });
  
          $("#SettingId").change(function () {
              if ($("#SettingId").val() == 1) {
                  showGenderDescription = true;
              }
          });
  
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>My View Code:</p>
  
  <pre><code>@using (Html.BeginForm())
  {
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.GenderId, "Gender")
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.DropDownList("GenderId", (SelectList)ViewBag.GenderId, "--Select One--", new { id = "GenderId"})
          @Html.ValidationMessageFor(model =&gt; model.GenderId)
      &lt;/div&gt;
  
      @if(showGenderDescription)
      {
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.GenderDescription)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.GenderDescription)
              @Html.ValidationMessageFor(model =&gt; model.GenderDescription)
          &lt;/div&gt;
      }
  }
  </code></pre>
  
  <p>The dropdownlist works correctly on post back to the controller but I would like to show the description input box. Haven't seen anything out there that would duplicate this type of behavior (not in my searches anyway). As always any help would be appreciated! </p>