JS | How to restrict the number of resource available in the booking widget
Julien Pauthier
a créé un sujet
9 mois il y a
When an user books a resource (such as a car rental, a seat in a classroom, or a night in a B&B), the widget offers to select how many resources should be booked up to the maximum number of resources available. Should you prefer to restrict this maximum value a fixed amount (eg: 5 for instance), here is a short JavaScript to do so:
$(window).load(function () {
setTimeout(function() {
setListener();
}, 500);
});
function setListener() {
for (i = 0; i < document.getElementById("rcount").options.length; i++) {
if (document.getElementById("rcount").options[i].value > 5) {
document.getElementById("rcount").options[i].disabled = true;
document.getElementById("rcount").options[i].selected=false;
}
}
}
Julien Pauthier
When an user books a resource (such as a car rental, a seat in a classroom, or a night in a B&B), the widget offers to select how many resources should be booked up to the maximum number of resources available. Should you prefer to restrict this maximum value a fixed amount (eg: 5 for instance), here is a short JavaScript to do so: