click event
This commit is contained in:
parent
e35b7302cb
commit
f40afe684a
13 changed files with 151 additions and 20 deletions
16
examples/InteractiveElement/main.cpp
Normal file
16
examples/InteractiveElement/main.cpp
Normal 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!");
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue