Expand my Community achievements bar.

SOLVED

SolidJS - Button onClick not working

Avatar

Level 1

Hello, 
can someone advice if I handle onClick with vanilla js is working but if I use the onclick with Solidjs is not working.
I do not get any errors:

 

 

import { JSX, createSignal } from 'solid-js';

import { render } from 'solid-js/web';




const App = (): JSX.Element => {

 

  document.addEventListener('DOMContentLoaded', function () {

    const button = document.getElementById('myButton') as HTMLButtonElement;

    button.addEventListener('click', function () {

      console.log('Experiment C - vanilla js');

    });

  });

  return (

    <>

      <button
        id="myButton"
        style={{ 'z-index': 3000, background: 'red' }}
      >

        click -JS
   
 
</button>
<button

        class="bttn-solid"

        style={{ 'z-index': 3000, background: 'red' }}

        onClick={() => console.log('Experiment C ')}

      >

        click me-Solid

      </button>


    </>

     

  );

};






 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 1

All good now

The issue was in the bundler

View solution in original post

3 Replies

Avatar

Employee Advisor

Where is it that you're trying to use that code?

Avatar

Correct answer by
Level 1

All good now

The issue was in the bundler

Avatar

Level 1

Hello,

 Hope this message finds you well

I just want to know how we connect AEM with soldJs.