jQuery .show() adds style=“display:inline-block” to elements

心不动则不痛 提交于 2019-12-04 03:08:11

Explicitly set the style for the visibility the way you want it: don't rely on hide() and show():

element.css('display', 'none'); equivalent of hide()
element.css('display', 'inline-block'); equivalent of show()
element.css('display', 'block'); What you want

I think if the defaut style for the element is inline then it will add inline-block, at least for select dropdowns it also adds inline-block. If you need to add block then use the .css

$('#el').css('display','block');

You can still use .hide() to hide, that does not need to change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!