I'm using niceselect for a custom selectbox. For some reason the selectbox does not close when an option is selected. I created a custom code to remove the open class from the selectbox element but it's not working...
var ns = $('.nice-select.open');
var ns_option = $('.nice-select.open li');
ns_option.on( "click", function() {
ns.removeClass( "open" );
});
Any insight would be greatly appreciated
Try this:
With jQuery, when selecting a class within a parent class, you need to have a space between each class name so rather than ".nice-select.open li" it should be ".nice-select .open li" as per the code above.