我正在为自定义组合框使用 bootstrap-select,在他们的外部 css 中有给类
.hide{ display: none !important; }.
我也在使用相同的类 .hide{display:none}。但没有!重要。在所有区域中,如果我想显示该元素,我只是将其删除。在某些区域,我使用 jQuery 向下滑动而不是删除“.hide”类。 Bootstrap-Select affectes where I have used jQuery slide down.
请帮助我。
最佳答案
如果您想显示使用类名 .hide
隐藏的元素,您应该删除该类而不是设置内联样式。
document.querySelector( '.myComboBox' ).classList.remove( 'hide' );
关于javascript - 无法覆盖 css 类!对内联样式很重要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24795898/