Home  >  Article  >  Web Front-end  >  jQuery toggle() sets CSS style_jquery

jQuery toggle() sets CSS style_jquery

WBOY
WBOYOriginal
2016-05-16 18:42:181397browse

toggle()
Toggle the visible state of the element.
If the element is visible, switch to hidden; if the element is hidden, switch to visible.
——————————————————————————————————————————————————————
Example
Toggle the visible state of all paragraphs.
HTML code:

Hello

Hello Again


jQuery code:
$("p" ).toggle()
Result:

Hello

Hello Again


Set a background image to highlight the effect of transparency

Copy code The code is as follows:

< head>
toggle()