# new HTMLElement()
Methods
# (static) html(content) → {object|string}
Short hand jQuery-Like html() function to set the html-content of an object
Parameters:
Name | Type | Description |
---|---|---|
content |
string | undefined | The HTML content to set |
Returns:
if no content is set, returns the current content, otherwise sets the content and returns the object
- Type
- object | string
Example
j.query("div#myDiv").html("Hello world!") // sets the content of the div with id #myDiv to "Hello world!"
# (async, static) jhtml(content) → {object|string}
Short hand jQuery-Like html() function to set the html-content of an object, but also run smarty conversiont before
Parameters:
Name | Type | Description |
---|---|---|
content |
string | undefined | The HTML smarty template to set |
Returns:
if no content is set, returns the current content, otherwise sets the content and returns the object
- Type
- object | string
Example
await j.query("div#myDiv").jhtml("{$hello_world}") // sets the content of the div with id #myDiv to "Hallo Welt!" in german or whatever language is currently set
# (static) on(eventname, callback) → {object}
Short hand jQuery-Like on() function to add event listeners to an object
Parameters:
Name | Type | Description |
---|---|---|
eventname |
string | |
callback |
CallableFunction |
Returns:
the object
- Type
- object
Example
j.query("form").on('submit', () => doSomething()); // adds an event callback for the submit-event on the first form on the page