I did an exclusive menu of 2 input checkboxes
on the following link :
As you can see, each input checkbox
corresponds to a different case : (Player Vs Computer) and (Player1 Vs Player2) and each case is associated to 2 buttons
(which work as I want).
My issue is that I would like to add a functionality, i.e enable to uncheck the current checkhed box by clicking on the current checkbox (this one which is already checked).
For the moment, I have to click directly on the other input checkbox
to uncheck the current one; I would like to get the both functionalities.
Here's the current code which handles these 2 exclusive input checkbox
:
// Check input checked
checkBoxState = $('#'+gameType+'').find('.game').prop('checked');
// Set oneButtonClicked to no for restore
$('#formGame').prop('oneButtonClicked', 'no');
// Handling input.game
$('#'+gameType+'').find('.game').prop('checked', !checkBoxState);
//$('#'+gameType+'').siblings().find('.game').prop('checked', checkBoxState);
// Set pointer-events to all for formGame
$('#formGame').css('pointer-events', 'all');
// Handling button.btn
$('#'+gameType+'').find('.btn').css('pointer-events', 'none');
$('#'+gameType+'').siblings().find('.btn').css('pointer-events', 'all');
$('#'+gameType+'').find('.btn').prop('disabled', checkBoxState);
$('#'+gameType+'').siblings().find('.btn').prop('disabled', !checkBoxState);
gameType
is the current type of game (Player Vs Computer or Player1 Vs Player2).
input.game
represent the input checkboxes
button.btn
represent the 2 buttons available for each ìnput.game
.
If someone could tell me how to add this functionality, i.e unchek by clicking on current checked ,or unchek by clicking directly on the other checkbox ...
Feel free to ask me further informations about this issue.
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire