17 lines
No EOL
650 B
C++
17 lines
No EOL
650 B
C++
import Crafter.CppDOM;
|
|
import std;
|
|
using namespace Crafter;
|
|
|
|
|
|
HtmlElement* body = new HtmlElement("body", R"(<h1>Input GetValue() and SetValue() Example</h1><br><input id="input" type="text" placeholder="Enter your text here..."><br><button id="button">Change Value</button><p id ="valueOutput"></p>)");
|
|
HtmlElement* button = new HtmlElement("button");
|
|
HtmlElement* output = new HtmlElement("valueOutput");
|
|
HtmlElement* input = new HtmlElement("input");
|
|
|
|
int main(){
|
|
button->AddClickListener([](Crafter::MouseEvent) {
|
|
std::string newValue = input->GetValue();
|
|
output->SetInnerHTML(newValue);
|
|
input->SetValue("");
|
|
});
|
|
} |