.css('display':'block') doesn't work

  The little rookie encountered the problem that .css('display':'block'), .css('display':'none') does not work today

It may be because of the use of plugins:

display :block is a property and property value in css. And show() is a function encapsulated by Jquery.

After using display:none to hide, the entire li element is removed from the dom document. And hide() only changes the width and height of the li element, and the li element is still in the dom tree and has not been eliminated, so the built-in list-style will still exist.


In addition, .css("display","block") only modifies the element's display to none, and the show() method modifies the element's display to the browser's default element's display value.

Replenish:

$("#id").show() means display:block, $("#id").hide() means display:none; $("#id").toggle() toggles the visible state of the element. If the element is visible, switch to hidden; if the element is hidden, switch to visible.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325520573&siteId=291194637