Gcobani Mkontwana

Gcobani Mkontwana

  • 1.5k
  • 282
  • 8k

How to make checkbox work with your button in Jquery?

Nov 15 2019 2:24 AM
Hi Team
 
I have created 3 checkbox on my HTML, i want to find a way that each should check if is enable, must allow a user an option when one is clicked. It must communicate with my Jquery button for download i have created. Can anyone show me how to do this based on this given code i have created, help will be appreciated.
 
 
<div class = "custom-control custom-checkbox">
<input type="checkbox" class ="custom-control-input" id="temperature">
<label class = "custom-control-label" for="temperature">Temperature</label>
</div>
<div class = "custom-control custom-checkbox">
<input type = "checkbox" class="custom-control-input" id="illuminance">
<label class = "custom-control-label" for = "illuminance">Illuminance</label>
</div>
<div class ="custom-control custom-checkbox">
<input type ="checkbox" class="custom-control-input" id="button-state">
<label class ="custom-control-label" for = "button-state">Button-State</label>
<!---Downloading File using
Jquery with Buttons---->
<div class="form-group"><br>
<div class="col-md-1.9 text-center">
<button id="download" name="download" class="btn btn-warning" >Download</button><br>
</div>
</div>
 
 
// Downloading file into zip file.
$(document).ready(function() {
$("#download").click(function() {
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';
});
});
 

Answers (2)