

It's a convenient and useful function, but it does involve a rather large chunk of code. The following helpers are quite convenient, but in order to keep things simple, the show() function requires an additional argument the target display value of the element (block, inline-block, inline, etc.): function hide(el) For example, the span is an inline element. display: block Using the block value makes the opposite. By using the display: inline for div element, it will behave like an inline element. a span has inline as its default display value. display: inline This will change the behavior of a block element to an inline element. Showing an element is more difficult, because this functionality must take into account stylesheet rules, as well as the default display style of an element.

Hiding an element is always done by setting its display style to 'none'. However, creating a function, such as $.show() and $.hide() in jQuery, requires a bit more than that. or if the div element is hidden by default via CSS stylesheet Showing and hiding an element can be achieved by toggling its display style: var el = document.querySelect('div') Hiding an element is always done by setting its display style to. hide () in jQuery, requires a bit more than that.

Showing and hiding an element can be achieved by toggling its display style: However, creating a function, such as. Toggle an element's display property for rendering it visible or invisible. Toggle an element's display property for rendering it visible or invisible.
