_newTag
creates a DOM-Object.
Requires
import {_newTag} from "./tt/ttHTML.js";
Definition
domElement = _newTag (tagName, attributes, childs);
Description
_newTag
creates a set of custom DOM-Elements with custom attributes and childs.
Parameters
tagName
: a string-formatted Tag-Type, such as "div"
or any other tag-type
attributes
: a JSON-Object including all properties to be attached to the DOM-Element
childs
: an Array of child Elements.
Return Value
_newCSS
returns the newly created style
-typed DOM-Object
Remarks
_newTag is being used in the tiktag-Framework to process JSX-Statements. You require to import {_newTag}
as shown above or in the examples below in your code to use JSX.
Example 1: use _newTag as a function
main.js:
import {_newTag} from "./tt/ttHTML.js";
var element = _newTag("div",{style:"color:grey;font-size:xxx-large"}, ["Tiktag makes coding easy!"]);
document.body.appendChild(element);
Output:

Example 2: JSX-Code
main.js:
import {_newTag} from "./tt/ttHTML.js";
document.body.appendChild(<div style="color:red;font-size:xxx-large">Tiktag <a href="https://tiktag.de/">Home</a></div>);
Output:
