Static element creator helper.
const $btn = $.t('<button>', {
class: 'btn btn-primary',
text: 'Click Me',
click: () => console.log('Hi')
});
$('body').append($btn);
<button class="btn btn-primary">Click Me</button>
const $card = $.t('<div>', {
class: 'card',
html: '<h1>Title</h1>',
css: { border: '1px solid black' },
data: { id: 101 }
});
<div class="card" style="border: 1px solid black;">
<h1>Title</h1>
</div>
| Parameter | Type | Description |
|---|---|---|
| html | string | An HTML string representing the element to create (e.g., <div>). |
| props | object | An object of properties, attributes, and events to apply. Supported keys:
|
Returns: A new SR object containing the created element.