i am very new to coding so please be gentle. i have been given a project by a college that i am studying at. to build an online interactive tutorial, very much in the same vane as codecademy and the like. the problem is i do not have very much experience with javascript or jquery, as i have not been taught them yet. at the end of the project what they want is an online interactive tutorial with a live preview of the html and the css. the problem is i have no idea how to go about doing all this without any help this is why i am here.
i have been doing quite a bit of research and have found a couple of very good prospects for helping me to achieve this. they are ace editor and codemirror the problem is there are no tutorials that i can find to help me.
i have been able to get the html working with a live preview but not css. here is my jquery code.
//initializing ace editor
var htmleditor = ace.edit("htmleditor");
htmleditor.setTheme("ace/theme/twilight");
htmleditor.session.setMode("ace/mode/html");
var csseditor = ace.edit("csseditor");
csseditor.setTheme("ace/theme/twilight");
csseditor.session.setMode("ace/mode/css");
//html editor
function showHTML() {
$('#return').html(htmleditor.getValue());
}
function showHTMLInIFrame() {
$('#return').html("<iframe src=" + "data:text/html," + encodeURIComponent(htmleditor.getValue()) + "></iframe>");
}
htmleditor.on("input", showHTMLInIFrame);
//css editor
function showCss() {
$('#return').css(csseditor.getValue());
}
function showCssInIFrame() {
$('#return').css("<iframe src=" + "data:text/css," + encodeURIComponent(csseditor.getValue()) + "></iframe>");
}
csseditor.on("input", showCssInIFrame);
i have all the required js files attatched to my html. any help would be very much appreciated, even if you are just pointing me in the right direction. though if anyone can come up with a solution to the problem i am faced with, please let me know.
regards
Phil
text content of bootstrap modal body flows outside. when long text without any space. I need a solution.text content should not overlapping when text is long <script src="https://ajax....
text content of bootstrap modal body flows outside. when long text without any space. I need a solution.text content should not overlapping when text is long <script src="https://ajax....
what is the easiest way to retrieve form values to send to localStorage as a JSON string? I started a function with a for loop but am stuck..any nudges are greatly appreciated(still very new to this) ...
what is the easiest way to retrieve form values to send to localStorage as a JSON string? I started a function with a for loop but am stuck..any nudges are greatly appreciated(still very new to this) ...
I'm trying not to mutate an object within an object before setting it to state like this: isDraggable = () => { let steps = [...this.state.stepsData]; steps = steps.map(step => ...
I'm trying not to mutate an object within an object before setting it to state like this: isDraggable = () => { let steps = [...this.state.stepsData]; steps = steps.map(step => ...
I have a function that finds the longest word in a string. function findLongestWord(str) { var longest = str.split(' ').reduce((longestWord, currentWord) =>{ return currentWord.length > ...
I have a function that finds the longest word in a string. function findLongestWord(str) { var longest = str.split(' ').reduce((longestWord, currentWord) =>{ return currentWord.length > ...