且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如果在jQuery中选择了选项,则显示div

更新时间:2022-06-12 06:22:15

option改为value。

First of all you should change "id" on your "option" to "value".

然后,您可以使用:

$(function () {
  $("#graph_select").change(function() {
    var val = $(this).val();
    if(val === "pilot_graph_form") {
        $("#pilot_graph_form").show();
        $("#client_graph_form").hide():
    }
    else if(val === "client_form") {
        $("#client_graph_form").show();
        $("#pilot_graph_form").hide();
    }
  });
});