_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

toggle not working within label

Open pmz opened this issue 2 years ago • 1 comments

<label _="on click toggle .bg-gray-300 on me" class="p-4 border rounded cursor-pointer hover:bg-gray-200"> <input type="checkbox" name="{{ category }}" value="{{ option }}" class="hidden"> <div>{{ option }}</div> </label>

This doesn't work. If I replace the label with a div, it works as intended.

Any ideas why? :)

pmz avatar Sep 25 '23 10:09 pmz

@pmz I just tried using a very simple setup, also using tailwindcss like you seem to be using and it works as intended:

<html>
    <head>
        <script src="https://cdn.tailwindcss.com"></script>
        <script src="https://unpkg.com/[email protected]"></script>
    </head>
    <body>
        <label _="on click toggle .bg-gray-300 on me" class="p-4 border rounded cursor-pointer hover:bg-gray-200">
            My Label
        </label>
    </body>
</html>

samueldominguez avatar Nov 20 '23 00:11 samueldominguez