Reset a nice-select (jquery-nice-select) dropdown

How can I reset a dropdown created with JQuery Nice Select plugin ? Nice Select JQuery Plugin: https://github.com/hernansartorio/jquery-nice-select

 <select name="married" class="nice-select">
 <option value="">Select</option>
 <option value="Yes">Yes</option>
 <option value="No">No</option>
 </select>


$('nice-select').niceSelect();

1 answer

  • answered 2021-05-17 06:02 Web_Developer

    Reset button click handling to reset the dropdown:

    $('#reset_btn').on('click', function(e){
          $('.nice-select').val('');
          $('.nice-select').niceSelect('update'); 
    });