javascript - in Jquery, how can I make the content be hidden by default? -


In this code, which is from (). What should I add to the function, so it is hidden by default?

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; Click $ (document) .ready (function () {$ ("# hide") (function () {$ ("p"). Hide ();}); $ ("# show"). Function () {$ ("P"). Show ();});}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; P & gt; If you click on the "hide" button, then I will disappear. & Lt; / P & gt; & Lt; Button ID = "Hide" & gt; Hide & lt; / Button & gt; & Lt; Button id = "show" & gt; Show & lt; / Button & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

You can use pure CSS:

 < Code> p {Display: none}  

If you are looking for a jQuery solution, then you :

  $ ( Documents) can use $ ("P"). $ ("P") $ ("#"). Click $ ("# Hide") (function () {$ ("p"). Hide ();}); $ ("#show") Click (function () {$ ("p"). Show ();}}}}};  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -