JSFiddle - React, Tailwind, and code Playground

by fenderistic

HTML

<label><input type="checkbox" onclick="selectEntireRange(this);"/> Select ALL Ranges</label>

<div id="out"></div>

JavaScript

//to ensure un checked at start up (which may not be desired)
$("#hid").html("0");
$("#chk").attr('checked', false);
function isChecked(){
    if($("#hid").html()=="1"){
     return true;   
    } else { 
        return false;
    }
}
function selectEntireRange(checkElement)
{
  // if checked - remove check and display table rows normally
  if(isChecked())
  {
    //ALWAYS EXECUTES HERE!
    checkElement.checked = false;
    $("#out").html("set to 0");
      $("#hid").html("0");
  }
  // if unchecked - mark 'checked' and grey out all table rows
  else
  {
    checkElement.checked = true;
    $("#out").html("set to 1");
     $("#hid").html("1");
  }
}