Link to website: https://island-paradise-tours.myshopify.com/products/full-day-excursion-6-hours (password = paradiseTours)
I am working for the first time in Shopify and in hopes to find out how to limit the total number of checkboxes a user can select when they are going through the steps of selecting “What activities would you like to add?”
You will see this on the page after you select a date/time for the service. I need it to cap at 4 checkboxes max to just throw an alert. I can spice the design up later, but just need to catch an error.
Like I said, I’m using Shopify and I am using a plugin or app called Propel Appointment Booking. It allows you to add custom questions (i.e. Checkbox), but I can’t set a max limit.
Overall, the goal is to make sure the user doesn’t select more than 4 of the 11 checkboxes. And at the moment, I have no way of adding a specific ID or Class to the input field to call it. Little lost.
Code I am using:
window.onload = function () {
const input = document.querySelector('input[type=checkbox]');
function check() {
if (input.checked) {
alert("checked");
} else {
alert("You didn't check it.");
}
}
input.onchange = check;
check();
}