Which am I better off doing? .hide()
is quicker than writing out .css(\"display\", \"none\")
, but what’s the difference and what are both of them a
.hide() stores the previous display
property just before setting it to none
, so if it wasn't the standard display
property for the element you're a bit safer, .show() will use that stored property as what to go back to. So...it does some extra work, but unless you're doing tons of elements, the speed difference should be negligible.