jquery - Any reason why one would call hide() before show()? -
why 1 want call hide() before show() ? i'd know before optimize method chaining..
function showsomething() { jquery("something").hide(); jquery("something").show(); }
when calling hide() initial value of element's display stored when show() called, initial value put in place. if no initial value set, show() set display:block.
so, if element display:inline, (let's say) .css("display","none") called on element, hidden no initial property saved. when show() element again given display:block - not it's initial value of inline given if we'd used hide().
to summarize: hide() preserve original display value ready show() use
source: jquery hide() documentation
Comments
Post a Comment