Answer the question
In order to leave comments, you need to log in
Process code written in textarea?
The idea is this. The form has a <textarea id="code"></textarea>
, in which I write the code.
Let's say:
===========================
var t=5, z=6, m;
m=t+z;
=============================
Next, we have the following component: <div id="result"></div>
, where I would like to output the result ... But how to do it I don't really know... Any advice?
============================
Here's what else is important, I would like to solve the problem using only the possibilities of JavaScript, without PHP or any Frameworks ....
============================
Thank you!
Answer the question
In order to leave comments, you need to log in
eval
eval('code here') is a help to you - it will be executed as
code .
read text from textarea into variable, into eval and result into div
Try adding a script element to the page and write the entire text content of the text area to the innerHTML of that element.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question