click event

This commit is contained in:
Jorijn van der Graaf 2025-11-09 22:43:52 +01:00
commit f40afe684a
13 changed files with 151 additions and 20 deletions

View file

@ -0,0 +1,16 @@
import Crafter.CppDOM;
import std;
using namespace Crafter;
HtmlElement body("body","<h1>Interactive Element Demo</h1>"
"<button id='myButton'>Click Me!</button>"
"<p id='output'>Click the button above</p>");
HtmlElement* button = new HtmlElement("myButton"); //prevent destruction
int main() {
button->AddClickListener([](){
auto output = HtmlElement("output");
output.SetInnerHTML("Button was clicked!");
});
}