JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<form action="">
    <div id="opwp_woo_tickets">
        <input type="checkbox" class="maxtickets_enable_cb" name="opwp_wootickets[tickets][0][enable]" />check1
        <div class="max_tickets">
            <input type="text" name="opwp_wootickets[tickets][0][maxtickets]" />
        </div>
        <input type="checkbox" class="maxtickets_enable_cb" name="opwp_wootickets[tickets][1][enable]" />check2
        <div class="max_tickets">
            <input type="text" name="opwp_wootickets[tickets][1][maxtickets]" />
        </div>
        <input type="checkbox" class="maxtickets_enable_cb" name="opwp_wootickets[tickets][2][enable]" />check3
        <div class="max_tickets">
            <input type="text" name="opwp_wootickets[tickets][2][maxtickets]" />
        </div>
    </div>
</form>

JavaScript

$('input[type="checkbox"]').change(function(){
    $(this).next('.max_tickets').toggle(this.checked);
}).change();