Solved
SolidJS - Button onClick not working
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>
</>
);
};