16 lines
No EOL
581 B
C++
16 lines
No EOL
581 B
C++
import Crafter.CppDOM;
|
|
import std;
|
|
using namespace Crafter;
|
|
|
|
HtmlElementPtr body("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>)");
|
|
HtmlElementPtr button("button");
|
|
HtmlElementPtr output("valueOutput");
|
|
HtmlElementPtr input("input");
|
|
|
|
int main(){
|
|
button.AddClickListener([](Crafter::MouseEvent) {
|
|
std::string newValue = input.GetValue();
|
|
output.SetInnerHTML(newValue);
|
|
input.SetValue("");
|
|
});
|
|
} |