Summary: I'm looking for way to add a toggle or a checkbox that can turn on/off this particular script:
<script src="disabledbuttons.js"></script> (More on this later)
The toggle should function as this:
ON by default; If ON, allow the script above. If OFF, disable the script.
If going to use a checkbox instead, a checked checkbox is ON.
To explain the use of the tool briefly, let's say I have 10 buttons. If I click 1, it will insert the word "one" in the textarea and 2 for "two", and so on...
Now that's not the focus of my question. What I have in mind is, with those 10 buttons, there's another function happening every time each button is clicked... and that is by disabling the other buttons not related to it.
So let's say: for button 1, every time it's clicked it will disable certain specified buttons, like 5 or 6 or 10. This is also the case for the other buttons. It doesn't matter for now which is which. But this feature here is the one I mentioned above <script src="disabledbuttons.js"></script>
And it looks like this:
function resetall() {
document.getElementById("2nd").disabled = false;
document.getElementById("1st").disabled = false;
document.getElementById("3rd").disabled = false;
document.getElementById("4th").disabled = false;
}
function disable1st() {
document.getElementById("1st").disabled = true;
document.getElementById("2nd").disabled = false;
document.getElementById("3rd").disabled = true;
document.getElementById("4th").disabled = true;
}
function disable2nd() {
document.getElementById("2nd").disabled = true;
document.getElementById("1st").disabled = false;
document.getElementById("3rd").disabled = false;
document.getElementById("4th").disabled = true;
}
function disable3rd() {
document.getElementById("2nd").disabled = true;
document.getElementById("1st").disabled = false;
document.getElementById("3rd").disabled = true;
document.getElementById("4th").disabled = true;
}
function disable4th() {
document.getElementById("2nd").disabled = false;
document.getElementById("1st").disabled = false;
document.getElementById("3rd").disabled = true;
document.getElementById("4th").disabled = true;
}
<button id="reset" onclick="resetall()">Reset</button>
<br><br>
<button id="1st" onclick="disable1st()">1</button>
<button id="2nd" onclick="disable2nd()">2</button>
<button id="3rd" onclick="disable3rd()">3</button>
<button id="4th" onclick="disable4th()">4</button>
I know this sample doesn't exactly reflect what I mentioned above, but it's a simplified version of it. How it works is, if I click a button, it disables the specified buttons based on if it's true or false.
What I really want and need is to have a toggle like this:
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
<label class="switch">
<input type="checkbox" checked>
<span class="slider round"></span>
</label>
This toggle will then serve as a way to turn on/off the script. In other words, if turned off, no feature that disables other buttons... users can freely click on any combination of buttons.
If turned on, allows the user to use the "guided" mode that disabled other buttons onclick of a button.
I have already set everything up I need, except for this toggle (or checkbox). I really need it (as a settings for the tool) but I don't know how to start.
I would really appreciate any help so that I may move on from this problem.

switchthat can either turn on or off that feature or script above. I'm still new to coding that's why I have no clue how to make it possible... but will appreciate any help.