Skip to content

Commit

Permalink
初期状態およびチェックボックスの変更時にいったんすべてのボタンを隠す
Browse files Browse the repository at this point in the history
  • Loading branch information
jun68ykt committed Jul 16, 2019
1 parent 7a52495 commit c1a6133
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.html
Expand Up @@ -6,8 +6,10 @@
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
$(function() {
$('.button').hide();

$('input[name="check"]').change(function() {
$('button').hide();
$('.button').hide();
if ($('input[name="check"]:checked').length >= 3) {
var _tmp = [];
$('input[name="check"]:checked').each(function() {
Expand All @@ -25,7 +27,6 @@

var showClasses = Object.entries(data).filter(([_, value]) => value >= 3).map(e => e[0]);

$('.button').hide();
showClasses.forEach(clazz => {
$(`.button.${clazz}`).show();
});
Expand Down

0 comments on commit c1a6133

Please sign in to comment.