click a data toggle button using Jquery -
i have form has 4 data toggle tabs , submit button @ 4th tab. when click submit button, showing popup alert on filed not correct. should navigate 1st tab. how can click data toggle button using jquery ? tried many methods .click
, .trigger
, show
, hide
etc. not working.. of try..
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> function triger() { $('#trigered').trigger('click'); } function trigered () { $('#vamsi').show(); alert('hello. clicked'); } <script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css"> <button onclick="triger();">click me button 1</button> <button onclick="trigered();" id="trigered">clicked</button> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="generalinfo"> <h2 id="vamsi">vamsi</h2> </div> <div role="tabpanel" class="tab-pane" id="address"> vamsi vamsi </div> <a href="#generalinfo" aria-controls="generalinfo" role="tab" data-toggle="tab">general info</a> <a href="#address" aria-controls="address" role="tab" data-toggle="tab" id="trigered" >address</a> </div>
Comments
Post a Comment