From d0cbfb251f2cd606bee2b9cd7a8692f1d1146b47 Mon Sep 17 00:00:00 2001 From: adityacp Date: Wed, 30 Nov 2016 17:38:26 +0530 Subject: Render Instructions from textarea --- yaksh/static/yaksh/js/add_quiz.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'yaksh/static') diff --git a/yaksh/static/yaksh/js/add_quiz.js b/yaksh/static/yaksh/js/add_quiz.js index 3da4d5c..a026ec0 100644 --- a/yaksh/static/yaksh/js/add_quiz.js +++ b/yaksh/static/yaksh/js/add_quiz.js @@ -7,6 +7,12 @@ function test() { document.getElementById("submit").innerHTML = "Save"; } + var template = "
" + $(template).insertBefore("#id_instructions"); + $('#id_instructions').bind('keypress', function (event){ + document.getElementById('rendered_text').innerHTML = document.getElementById('id_instructions').value ; + }); + document.getElementById('rendered_text').innerHTML = document.getElementById('id_instructions').value ; } String.prototype.beginsWith = function (string) { -- cgit From 134ae5e8ecdb5ff4aa6366d3081c7cd6d985fcb6 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 1 Dec 2016 15:48:21 +0530 Subject: removed bind function instead used keypress --- yaksh/static/yaksh/js/add_quiz.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'yaksh/static') diff --git a/yaksh/static/yaksh/js/add_quiz.js b/yaksh/static/yaksh/js/add_quiz.js index a026ec0..e06c863 100644 --- a/yaksh/static/yaksh/js/add_quiz.js +++ b/yaksh/static/yaksh/js/add_quiz.js @@ -7,9 +7,9 @@ function test() { document.getElementById("submit").innerHTML = "Save"; } - var template = "" + var template = ""; $(template).insertBefore("#id_instructions"); - $('#id_instructions').bind('keypress', function (event){ + $('#id_instructions').keypress(function (event){ document.getElementById('rendered_text').innerHTML = document.getElementById('id_instructions').value ; }); document.getElementById('rendered_text').innerHTML = document.getElementById('id_instructions').value ; -- cgit From 4b501a76d19e0ecbb2f75d4e2402a24a3bb47429 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 1 Dec 2016 16:00:14 +0530 Subject: removed extra html tag and changed alignment of rendered text --- yaksh/static/yaksh/js/add_quiz.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yaksh/static') diff --git a/yaksh/static/yaksh/js/add_quiz.js b/yaksh/static/yaksh/js/add_quiz.js index e06c863..f4067ed 100644 --- a/yaksh/static/yaksh/js/add_quiz.js +++ b/yaksh/static/yaksh/js/add_quiz.js @@ -7,7 +7,7 @@ function test() { document.getElementById("submit").innerHTML = "Save"; } - var template = ""; + var template = ""; $(template).insertBefore("#id_instructions"); $('#id_instructions').keypress(function (event){ document.getElementById('rendered_text').innerHTML = document.getElementById('id_instructions').value ; -- cgit