I have made single tabs that contain buttons. enter image description here
// Create the tab content
const tabContent = document.createElement('div');
// Add your desired content for each tab dynamically
const tabContents = [
'<button class="CodeButton" onclick="myFunction">Button1</button><br/><button class="CodeButton">Button2</button>'
];
function myFunction()
{
alert("test");
}
My goal is that after the button press something happens, e.g. a notification comes or the size of the elements of the page changes.
Unfortunately I can't get it to work , to make the "click event". I guess it has to do with the fact that the tabs are "container".
It's because you need to call the function with the parentheses:
It's not always necessary, but in this case it is. Run the example below to test it: