Difference between jQuery .hide() and .css(“display”, “none”)

后端 未结 7 1098
既然无缘
既然无缘 2020-12-12 14:33

Is there any difference between

jQuery(\'#id\').show() and jQuery(\'#id\').css(\"display\",\"block\")

and

jQuery(\'#id\').         


        
相关标签:
7条回答
  • 2020-12-12 15:32

    see http://api.jquery.com/show/

    With no parameters, the .show() method is the simplest way to display an element:

    $('.target').show();

    The matched elements will be revealed immediately, with no animation. This is roughly equivalent to calling .css('display', 'block'), except that the display property is restored to whatever it was initially. If an element has a display value of inline, then is hidden and shown, it will once again be displayed inline.

    0 讨论(0)
提交回复
热议问题