JSFiddle - React, Tailwind, and code Playground

by sarathsprakash

HTML

<input type="checkbox" id="hello" />hello
<div id="hello_div">hello</div>

JavaScript

$(':checkbox').change(function () {
     var this_name = (this.id);
     alert(this_name);

     if ($('#' + this_name).prop('checked')) {
         $('#' + this_name + '_div').show();
     } else {
         $('#' + this_name + '_div').hide();
     }



 });