Display div if a specific select option value is selected

前端 未结 7 1462
执笔经年
执笔经年 2021-02-02 03:57

I am trying to display a div if user select a specific option value from a select drop down list.

Example:

The select drop down list consist of dynamic names fet

相关标签:
7条回答
  • 2021-02-02 04:22

    Change this.select to this:

     <select id="getFname" onchange="admSelectCheck(this);">
    

    Then it should work okay. Also if you have jQuery you can simply do:

    $("#getFname").change(function() {
       var val = $(this).text();
       if (val != "Admin") {
          $("#div").show();
       }
    });
    

    Will supply a pure JS function too.

    0 讨论(0)
提交回复
热议问题