Clicking grant labels now correctly toggles the check mark.

This commit is contained in:
John Shaver 2017-11-07 14:23:26 -07:00
parent d28ab68abc
commit 40bfe2e534
1 changed files with 14 additions and 11 deletions

View File

@ -47,25 +47,28 @@ $('body').on('click', '.js-remember-label', function (ev) {
$('body').on('click', '.check', function () {
'use strict';
var $img = $(this);
if($img.attr("src") === "./img/pressed-check.png") {
$img.attr("src", "./img/unpressed-check.png");
$img.removeClass("is-checked");
} else if($img.attr("src") === "./img/unpressed-check.png") {
$img.attr("src", "./img/pressed-check.png");
$img.addClass("is-checked");
}
});
$('body').on('click', '.js-auth-li-enabled', function (ev) {
'use strict';
ev.preventDefault();
ev.stopPropagation();
var $this = $(this);
if ($this.find('.js-auth-checkbox').is(':checked') === true) {
$this.find('.js-auth-checkbox').prop( "checked", false );
var $hiddenCheckbox = $this.find('.js-auth-checkbox');
var $img = $this.find('.check');
var newStatus = $hiddenCheckbox.prop('checked') ? "unchecked" : "checked";
if(newStatus === 'checked') {
$img.attr('src', './img/pressed-check.png');
$img.addClass("is-checked");
$hiddenCheckbox.prop( "checked", true );
} else {
$this.find('.js-auth-checkbox').prop( "checked", true );
$img.attr("src", "./img/unpressed-check.png");
$img.removeClass("is-checked");
$hiddenCheckbox.prop( "checked", false );
}
});