Click here to Skip to main content
15,671,149 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my code

    <script type="text/javascript">
    $('#myTab a').click(function (e) {
     <ul class="nav navbar-nav" id="myTab">
        <li class="active"><a href="Home.aspx" data-toggle="tab">HOME</a></li>
        <li><a href="AboutUs.aspx" data-toggle="tab">ABOUT US</a></li>
        <li><a href="ContactUs.aspx" data-toggle="tab">CONTACT US</a></li>
        <li><a href="Searchjob.aspx" data-toggle="tab">SEARCH JOBS</a></li>

No tab is now clickable. I want to make a tab active when clicked and other inactive.
Please help.

1 solution

AS you have added "e.preventDefault()" on click of anchor tags, it prevents anchor tags to open a link/page.

You have to call one javascript/jquery function on loading of page which will check the current page name and assign the "active" class to it's corresponding anchor tag in <li>.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900