jquery - Get value of seleceted child of ul - Bootstrap3 -


i want value of selected nav-stacked.

<div class="col-md-2">   <ul class="nav  nav-stacked nav-pills" id="sidebar">     <li class="active"><a href="#registration" data-toggle="tab">registration report</a></li>     <li><a href="#events" data-toggle="tab">events report</a></li>     <li><a href="#count" data-toggle="tab">count report</a></li>   </ul> </div>     <div class="tab-content">     <div class="tab-pane fade active" id="registration">                             content     </div>     <div class="tab-pane fade" id="count">         content     </div>     <div class="tab-pane fade" id="events">         content     </div> </div> 

how can value of selected nav-stacked.??

also, default registration active, content not shown. shows when click on it,ie on-change event.

you can href you're looking this:

alert( $('#sidebar li.active a').attr('href') )
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div class="col-md-2">    <ul class="nav  nav-stacked nav-pills" id="sidebar">      <li class="active"><a href="#registration" data-toggle="tab">registration report</a></li>      <li><a href="#events" data-toggle="tab">events report</a></li>      <li><a href="#count" data-toggle="tab">count report</a></li>    </ul>  </div>          <div class="tab-content">      <div class="tab-pane fade active" id="registration">                              content      </div>      <div class="tab-pane fade" id="count">          content      </div>      <div class="tab-pane fade" id="events">          content      </div>  </div>


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -