JSFiddle - React, Tailwind, and code Playground

by ian_smithz

HTML

<section class="BusinessSelection">
     <p>
        <input  type="checkbox" class="checkedList">
        <span class="BuIcon"></span>
        <span>Business Unit 1</span>
     </p>
     <p>
        <input  type="checkbox" class="checkedList">
        <span class="BuIcon"></span>
        <span>Business Unit 2</span>
     </p>
</section>
         
         <div id="dispbusiness"></div>

JavaScript

$(document).on('click', 'input:checkbox',function(){ 
    if($(this).is(':checked'))
    {
        var htmlcode=$(this).parents('p').clone();
        $('#dispbusiness').html(htmlcode);
    }
    
    else {
        $('#dispbusiness').html(htmlcode).remove();
    }
    
    
});