Skip to content Skip to sidebar Skip to footer

How To Make Your Checkbox Work With Your Jquery Functionality?

I have created 3 checkbox and i am struggling to make them to communicate with my Jquery button i have created to allow a user an option to select. If one is selected and other one

Solution 1:

You want to initiate the download if at least two checkboxes are checked?

In that case, try using this:

$(document).ready(function() {
    $("#download").click(function() {
        var count = 0;
        if ($('#temperature').prop('checked')) count++;
        if ($('#illuminance').prop('checked')) count++;
        if ($('#button-state').prop('checked')) count++;
        if (count > 1) {
            window.location.href ='https://api.thingspeak.com/channels/899906/feeds.csv?start=2019-11-12%2019:11:12&end=2019-11-13%2019:11:13';
        }
    });
});

Post a Comment for "How To Make Your Checkbox Work With Your Jquery Functionality?"