How do I reset a jquery-chosen select option with jQuery?

前端 未结 21 671
一个人的身影
一个人的身影 2020-11-30 21:42

I have tried numerous things and nothing seems to be working.

I am using jQuery and Chosen plugin.

Methods I have tried:

var select = jQuery(         


        
相关标签:
21条回答
  • 2020-11-30 22:34

    The new Chosen libraries don't use the liszt. I used the following:

    document.getElementById('autoship_option').selectedIndex = 0;
    $("#autoship_option").trigger("chosen:updated");
    
    0 讨论(0)
  • 2020-11-30 22:34
    jQuery('.chosen-processed').find('.search-choice-close').click();
    
    0 讨论(0)
  • 2020-11-30 22:35

    Simple add trigger change like this:

    $('#selectId').val('').trigger('change');
    
    0 讨论(0)
提交回复
热议问题