1

I have a tabs java scripts, but there is no default page. I want to open the site to chose a page as a default tab.

Please help me

$(document).ready(function(){
 $("#tabs a").on("click", function(e){
   e.preventDefault();
  var html = $(this).attr('href');
  var htmlurl = 'html/'+html;

   // update to the newest tab
   $("#tabs a").removeClass("active");
   $(this).addClass("active");

   // set the new page content
   $("#content-wrap").hide().load(htmlurl, function(){
  $(this).fadeIn(400);
   });
 });
  });
2
  • 2
    Need to explain your issue in more detail. As it stands now it is not clear at all what you want to acheive Commented Jul 7, 2015 at 23:38
  • Some HTML for context would help Commented Jul 8, 2015 at 1:18

1 Answer 1

1

Your problem doesn't seem to be clear to me, hovewer these lines didn't make sense.

// update to the newest tab
   $("#tabs a").removeClass("active");
   $(this).addClass("active");

In these lines , you refer to $("#tabs a") and remove the class and by using this statement , again you re adding the class.

Sign up to request clarification or add additional context in comments.

1 Comment

makes perfect sense... removes from other elements that have that class and adds to the one that event occurred on

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.