jquery - Hiding and showing button on click in twitter bootstrap -


i have following jquery , css i've used , worked, in new solution (which copy of existing one) not work:

                <script>                      $("#inprogress_btn").click(function () {                         if (!($("#inprogress_btn").is(":visible"))) {                             $("#onhold_btn").show();                             $("#inprogress_btn").hide();                         }                         else {                             $("#onhold_btn").hide();                             $("#inprogress_btn").show();                         }                     })                 </script>          <button style="margin-top:50px;" id="onhold_btn" class="btn btn-block btn-danger">on hold</button>         <button id="inprogress_btn" class="btn btn-block btn-success">in progress</button> 

what doing wrong?

it worked, please checkout jsfiddle, reference jquery 1.10.1, hope helps.

$(function(){     $("#inprogress_btn").click(function () {                if (!($("#inprogress_btn").is(":visible"))) {                     $("#onhold_btn").show();                     $("#inprogress_btn").hide();                 }                 else {                     $("#onhold_btn").hide();                     $("#inprogress_btn").show();                 }             }); }) 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -