# Interactive Element Example This example demonstrates how to use DOM event handling with Crafter.CppDOM. ## Features - Shows how to create interactive UI elements using C++ - Demonstrates the event listener framework for attaching callbacks - Illustrates how to respond to user interactions ## Usage ```cpp import Crafter.CppDOM; using namespace Crafter::CppDOM; int main(){ // Create UI elements HtmlElement body("body"); body.SetInnerHTML("
Click the button above
"); // Attach event listener HtmlElement button("myButton"); button.AddClickListener([]() { HtmlElement output("output"); output.SetInnerHTML("Button was clicked!"); }); return 0; } ``` ## Building and Running ```bash crafter-build build executable run.sh ``` Then navigate to `http://localhost:8080/` in your browser. If caddy is not installed, you can use your favorite static file server instead.