JSFiddle - React, Tailwind, and code Playground

by JS_learner

HTML

<div>
MyCheckbox
<input type="checkbox" id="Check1" name="FirstCkName" onclick="testCheckbox(Check1,TextBx1)" />
</div><br>

<div>
CheckBx Text Box
	<input id="TextBx1" name="CheckBxName"  type="text"  /> 
</div><br>

JavaScript

function testCheckbox(oCheckbox,oTxtbox)
{
    
    if (oCheckbox.checked == true)
    {
        document.getElementById("oTxtbox").value=1;
    }
    else
    {
        document.getElementById("oTxtbox").value="";
    }
}