Show/Hide different forms based on a option selected

后端 未结 7 1325
暗喜
暗喜 2021-02-04 19:28

I would like to know how to show/hide different forms based one form\'s selection.

In the sample code below all three forms are automatically set to display:none. I woul

7条回答
  •  离开以前
    2021-02-04 20:18

    
    
    
    
    
    
    ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
    

    JS:

    $("select").on("change", function() {
        $("#" + $(this).val()).show().siblings().hide();
    });​
    

    Sample at http://jsfiddle.net/dfYAs/

提交回复
热议问题