How to add display:inline-block in a jQuery show() function?

后端 未结 12 1970
执念已碎
执念已碎 2020-12-02 17:38

I have some code like this:

function switch_tabs(obj) {
    $(\'.tab-content\').hide();
    $(\'.tabs a\').removeClass(\"selected\");

    var id = obj.attr(         


        
12条回答
  •  既然无缘
    2020-12-02 18:42

    Setting the CSS property after you have used .show() should work. Maybe you are targeting the wrong element on your HTML page.

     $('#foo').css('display', 'inline-block');
    

    But if you are not using any effects of .show(), .hide() why don't you set those CSS properties manually like:

    $('#foo').css('display','none'); 
    $('#foo').css('display','inline-block');
    

提交回复
热议问题