I am using this code to toggle nav-bar active class but it is not working...

```
$('ul.nav>li').click(function(){
    $(this).parent().children('li').not(this).removeClass('active');
    $(this).addClass('active');
});

```

my nav bar code is: 

```
        <header class="row">
            <div class="col-sm-12 hidden-xs">
                <img src="images/header.png" class="logo-image img-responsive" alt=""/>
            </div>
            <div class="col-sm-12">
            <div class="clearfix"></div>
          <nav class="navbar navbar-inverse">
              <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                  </button>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                  <ul class="nav navbar-nav">
                    <li class="active"><a href="index.php">Category<span class="sr-only">(current)</span></a></li>
                    <li><a href="sub_category.php">Sub Category</a></li>
                  </ul>
                </div><!-- /.navbar-collapse -->
              </div><!-- /.container-fluid -->
            </nav>
            </div>
        </header>

```

i have updated the whole bootstrap code...

I am using bootstrap nav bar.