dimanche 16 janvier 2022

How should I code to: select checkbox -> table hide in 1sec -> console.log(hide) -> select checkbox again -> show the table -> console.log(show);?

Unfortunately it doesn't work. (Rather, it works, but not in a proper way.)

HTML:

  <div>
       <label id="myButton"> Show/Hide
            <input type="checkbox"  name="tableShowOrHide" value="C">
       </label>
  </div>

SCRIPT:

$('#myButton').click(function () {
    $('table').finish().show(1000, function () {
        console.log("We can see the table.");
    });
    $('#myButton').click(function () {
        $('table').finish().hide(1000, function () {
            console.log("Was there a table?!");
        });
    });
});

Thanks a lot in advance!




Aucun commentaire:

Enregistrer un commentaire