JQuery .show() vs .css('display', 'block)

2020. 7. 13. 09:27JavaScript/JQuery

728x90

https://stackoverflow.com/questions/3641532/whats-the-difference-between-show-and-cssdisplayblock

 

Assuming you have this at the beginning:

<span id="thisElement" style="display: none;">Foo</span>

 

when you call:

$('#thisElement').show();

 

you will get:

<span id="thisElement" style="">Foo</span>

 

while:

$('#thisElement').css({'display':'block'});

 

does:

<span id="thisElement" style="display: block;">Foo</span>

so, yes there's a difference.

728x90
반응형