Skip to content

Commit f9d9859

Browse files
committed
(docs) new section about echo DOM nodes
1 parent b82b357 commit f9d9859

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/docs/deep-dive/echo.mdx

+23
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,29 @@ change.
133133

134134
<CodePen id="xbKqpZG" title="Terminal Figlet" />
135135

136+
## DOM Nodes and jQuery Objects
137+
138+
jQuery Terminal don't allow to echo HTML directly, to prevent any misbehavior of your users, but you can
139+
echo DOM nodes (elements that represent HTML tags inside the browser):
140+
141+
```javascript
142+
const para = document.createElement('p');
143+
para.innerText = 'hello, world!';
144+
term.echo(para);
145+
```
146+
147+
and jQuery object:
148+
149+
```javascript
150+
const $iframe = $('<iframe src="https://example.com"></iframe>');
151+
term.echo($iframe);
152+
```
153+
154+
Dolar function from jQuery also accepts HTML code and it create jQuery object from it, that object
155+
which wraps DOM node, can later be inserted into document.
156+
157+
<CodePen id="VYZpVQY" title="echo DOM node and jQuery object" height={460} />
158+
136159
## renderHandler
137160

138161
When you have renderHandler you can print basciall anything, any kind of objects. Even [React

0 commit comments

Comments
 (0)