AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



html-code-editor: How to make HTML editor?

I want to make an html editor in which one side we type the code and other side it should display the output of the code. Please give me either an idea to make it or give me source code.

html x 24
code-editor x 1
Posted On : 2013-12-13 21:30:12.0
profile Rishi Kumar - anyforum.in Rishi Kumar
523188249150
up-rate
5
down-rate

Answers


Very interesting question. Let´s consider a very simple scenario in which we take a textarea to type the html code . and a div tag to display the output of html code. Following is the source code of very simple html code editor. Copy the following source code and paste it on notepad and save it as html file. Now open it with a browser.

HTML-Editor.html :
----------------------------

<!DOCTYPE html>
<html>
<head>
<script>
function showForm(){
var jtext =document.getElementById("text").value;
document.getElementById("location").innerHTML=jtext;
}
</script>
</head>
<body>
<textarea style="width:100%;background:#dfffff;fontsize:16px;height:300px;resize:none;" placeholder="type your html code" onkeyup="showForm()" id="text"></textarea>
<h1 style="text-align:center;">Output of above html code</h1>
<div style="border:1px solid black;min-height:200px;height:auto;" id="location"></div>
</body>
</html>

**************************************** Output ****************************************

Output of above html code


Posted On : 2013-12-13 22:23:15
Satisfied : 1 Yes  0 No
profile Saksham Kumar - anyforum.in Saksham Kumar
73433939091
Reply This Thread
up-rate
5
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in