logtech
logtech

Reputation: 5

jQuery .load content only shows for a second

I have this jQuery .load to get a div from another page. However when I click the link the other page's div only shows for a split second than it reverts back to the previous page's content.

 $(document).ready(function(){
   $("#contact").click(function(){
     $("#boxcontainer").load("contact.html #contBox");
   });
 });

Upvotes: 0

Views: 123

Answers (1)

Blender
Blender

Reputation: 298106

You probably need to prevent the default behavior from happening:

 $(document).ready(function(){
   $("#contact").click(function(e){
     e.preventDefault();

     $("#boxcontainer").load("contact.html #contBox");
   });
 });

Upvotes: 2

Related Questions