Skip to content Skip to sidebar Skip to footer

Conditional Dropdown Is Needed If The Option Is No Then Only The Other Should Appear If Not It Must Be Null

@**@

Solution 1:

I think what you are looking for is jquery. With this, you can check if the #son is set to "no" and then set another piece of code to show and hide. Here is a piece of code that should look a lot like what you want:

<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script></head><body><divclass="form-group"><labelasp-for="son"class="control-label">Son</label><selectname="son"id="son"><optionvalue="none"selected="selected"> -- choose one --</option><optionvalue="yes">Yes</option><optionvalue="no">No</option></select><divid="father"style="display: none;"><labelasp-for="father"class="control-label a">Father</label><selectname="father"><optionvalue="none"selected="selected"> -- choose one --</option><option>Signed SOW Awaited</option><option>Onboarding in Progress</option></select></div></div><script>
    $("#son").change(function() {
      if ($(this).val() === "no") {
        $("#father").show();
      } else {
        $("#father").hide();
      }
    });
  </script></body></html>

JQuery might be a little intimidating at first, but I suggest just sticking to the basics like this. This is also pretty much all I know about JQuery.

Post a Comment for "Conditional Dropdown Is Needed If The Option Is No Then Only The Other Should Appear If Not It Must Be Null"