JSFiddle - React, Tailwind, and code Playground

by arcm111

HTML

<input type="checkbox" class="myclass" onchange="test (this)"/> checkbox 1<br/>
<input type="checkbox" class="myclass" onchange="test (this)"/> checkbox 2<br/>
<input type="checkbox" class="myclass" onchange="test (this)"/> checkbox 3<br/>
<input type="checkbox" class="myclass" onchange="test (this)"/> checkbox 4<br/>

JavaScript

var count = 0;

function test (el)
{
	el.checked ? count++ : count--;
	if (count > 1) alert ("pingo");
}