jQuery show/hide a div based on select value

后端 未结 7 814
走了就别回头了
走了就别回头了 2020-12-10 13:02

I have a select list with values \'all\' and \'custom\'. On select with value \'custom\' a div with class \'resources\' should appear, and if the value is \'all\' it should

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-10 13:51

      $("#privileges").change(function(){
         var select=  $(this).val();
           if(select=='custom'){
              //some code
             }
        }); 
    

    or

      var select=$('#privileges :selected').val()
        if(select=='custom'){
        //some code
      }
    

提交回复
热议问题