Skip to content

Commit

Permalink
check if previously checked and if so then don't hide compare button.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpofo committed Jul 2, 2021
1 parent bfc196b commit 3b5dcff
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions templates/components/component_library.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,19 @@ <h2 class="">Component Library</h2>
{% block scripts %}
<script>
//Hide submit button until 1 checkbox is checked
$(document).ready(function() {

var $submit = $("#compare-components").hide(),
$cbs = $('input[name="compareCheckbox"]').click(function() {
$submit.toggle( $cbs.is(":checked") );
});
});
$(document).ready(function () {
var checkBoxValues = JSON.parse(localStorage.getItem('checkBoxValues'))
// If are no previously checked components then hide button
var $submit = $("#compare-components").hide()
if (checkBoxValues !== null) {
$submit.toggle();
} else {
$cbs = $('input[name="compareCheckbox"]').click(function () {

$submit.toggle($cbs.is(":checked"));
});
}
});

function select_all(val) {
// select and deselect with toggle
Expand Down

0 comments on commit 3b5dcff

Please sign in to comment.