Why doesn't jQuery show () work?

I use jQuery to hide a div via hide() .

Then, when the link is clicked, it will show the div , but for some reason it will not stay. it will appear for ms, then disappear.

HTML

 <div id="introContent"> <h1 id="introText">Welcome</h1> <p id="introParagraph">I create <strong>Responsive</strong>, <strong>Interactive</strong>, <strong>Beautiful</strong> Mobile ready Websites. Every Website is created from scratch for each client so no Two Projects are alike. Please read more about my Company and our work. "High Quality Work at Affordable Prices" </p> </div> 

JQuery

 $(function() { $("#introContent").hide(); $("#intro").click(function () { //$(#intro) is a link in my nav bar $("#introContent").show(); }); }); 
+6
source share
1 answer

Stop the browser from the default action of the selected item. Cancel click

 $(function() { $("#introContent").hide(); $("#intro").click(function (evt) { evt.preventDefault(); $("#introContent").show(); }); }); 
+10
source

Source: https://habr.com/ru/post/981076/


All Articles