forked from Raksha25/CodeRunner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
25 lines (24 loc) · 726 Bytes
/
script.js
File metadata and controls
25 lines (24 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
alert("Click on language pills to open different tabs.");
$(".toggle-btn").click(function () {
$(this).toggleClass("active");
if ($(this).attr("id") == "output") {
$("#outputDiv").toggle();
$("#output-txt").toggle();
} else {
$("#" + $(this).attr("id") + "TA").toggle();
}
});
$();
$("#runBtn").click(function () {
var addCode =
"<html><head><style type='text/css'>" +
$("#cssTA").val() +
"</style></head><body>" +
$("#htmlTA").val() +
"</body></html>";
$("iframe").contents().find("html").html(addCode);
document.getElementById("outputDiv").contentWindow.eval($("#jsTA").val());
});
if ($("#htmlTA").is(":visible")) {
$("#html").addClass("active");
}