How can I reset a form with jQuery chosen plugin?

后端 未结 10 1331
甜味超标
甜味超标 2020-12-04 15:12

I have a bunch of select elements in a form with which I am using the Jquery Chosen plugin. How can I reset the form? The following does not work:



        
10条回答
  •  我在风中等你
    2020-12-04 15:50

    For a more hassle free approach...assuming your inputs are inside

    tags:

    
        
         
    
    

    This is what I would do:

    $("input[type='reset'], button[type='reset']").click(function(e){
          setTimeout(function(){ $("select").trigger("chosen:updated"); }, 50);
    });
    

    See fiddle here.

提交回复
热议问题