added HtmlElement class

This commit is contained in:
Jorijn van der Graaf 2025-02-12 23:06:56 +01:00
commit 9ee52266b5
8 changed files with 55 additions and 38 deletions

View file

@ -38,13 +38,13 @@ Create a basic project file, that describes your web project.
Save and close the file, create a ``main.cpp``
```cpp
import Crafter.CppDOM;
using namespace Crafter::CppDOM;
int main(){
void* body = Crafter::CppDOM::Bindings::GetElementById("body");
Crafter::CppDOM::Bindings::SetInnerHTML(body, "Hello World!");
Crafter::CppDOM::Bindings::FreeJs(body);
HtmlElement body("body");
body.SetInnerHTML("Hello World!");
}
```
Save and close, then run ``crafter-webbuild serve -c debug``. Now you can open the browser at ``http://localhost:8080/`` and ``Hello World!`` will appear in the browser.
This sample can also be viewed in the [Hello World sample](https://github.com/Catcrafts/Crafter.CppDOM/tree/master/samples/HelloWorld)
This sample can also be viewed in the [HelloElement sample](https://github.com/Catcrafts/Crafter.CppDOM/tree/master/samples/HelloElement)